Pass an array of pointer in function
#include <stdio.h>
void display (int *[] , int );
int main()
{int a = 100, b=200, c=300;
int *x[3];
x[0] =&a;
x[1] = &b;
x[2] = &c;
display(x , 3);
return 0;
}
void display ( int *x[] , int num){
int counter ;
for(counter=0 ; counter<num ; counter++){
printf("%p ------> %d\n" , x[counter] , *(x[counter]));
}
}
Comments
Post a Comment