Sunday, July 12, 2009

(C++ programing:Arrays & Searching)Write a function that takes as an argument an array of integers?

Write a function that takes as an argument an array of integers, and alters each integer in the array so that it has double the value it did formerly. The return type of your function should be void. Write a program fragment that calls the function and prints out the array before and after the function is called.

(C++ programing:Arrays %26amp; Searching)Write a function that takes as an argument an array of integers?
wow. you just offloaded your homework question here. seriously, shouldn't you maybe even take the effort to add some rephrase or even some judicious comments, rather than just dumping your cut-and-paste-textbook-question over?
Reply:You will be passing a pointer to your function for the array, that is why you don't have to return anything. Just use a loop to step through the array. Is it assumed you know the size of the array beforehand, or does that need to be an argument as well?


No comments:

Post a Comment