hi, one of the basics i still got problems with is the use of pointers to arrays.
Code:
void function (int *p){
int i;
for(i=0; i<10;i++,p++)
*p=i; //fills array with numbers 0 to 9
}
int main (void){
int array[10];
function (&array[0]); //adress of first element in array
return 0;
}
is this a good way to use a pointer to an array?
now, you can also create a pointer to array by defining a doing something like:
Code:
void function (int *tab[]){
....
}
int main (void){
int *array[10];
function (array); //adress of first element in array
return 0;
}
whats the difference, whats better and most of all how do i use last this pointer to fill my array?