Monday, May 24, 2010

C++ programming question (1 question)?

ok i have everything done except this question...


looking at book...


no examples..


heres the qauestions...


code wins the best answer...


explain it to me too








Rewrite the following in pointer notation. Use the simplest form, assuming that this call is not part of a loop; in other words, do not include a counter which would reach the zero element:


array[0] -

C++ programming question (1 question)?
overload the - operator


array is already a pointer type


It can be *array-
Reply:ok there rally isn't enough information to answer your question (rewrite the following what?)


but heres some example code to that uses pointers to access an array element.





#define somenumber 10;


int array[ somenumber];





int * ptr =array; // now ptr is pointing at array[0];


int i = 0; // element of array


int x =*( ptr+i); // value of x equals the value of the array[i] for any i


No comments:

Post a Comment