- 论坛徽章:
- 0
|
Write a C routine which is passed three parameters. The first is an array of integers and the second is the length of the array. The third parameter, ‘p’, is an integer passed by reference. The routine should look for the first occurrence of the integer in the array and return a pointer to that array element. If the integer is not found, the routine should return NULL and should also increment ‘p’. Write a main program which fills the array with integers passed from the command line and then calls the routine with a value of ‘3’ for ‘p’. It should then output the value of ‘p’ and, if the return value was not NULL, the position in the array where the integer was found. You may assume that the command-line parameters are integers. |
|