Passing array element to a function in c -



Passing array element to a function in c -

code:

#include<stdio.h> void display (int *); void show(int **); int main() { int a[3] = {1,2,3} ; display(&a[2]); homecoming 0 ; } void display(int *n) { show( &n ); } void show (int *m) { printf("%d",**m); }

my aim define function name "show" can called function name "display" , both functions ("show" , "display") must called reference .the above programme gives error on "printf line" of "show()" "invalid type argument of unary '*' ". there error in programme ?

function declarator of show in definition doesn't match prototype.change

void show (int *m) { printf("%d",**m); }

to

void show (int **m) { printf("%d",**m); }

c arrays pointers pass-by-reference

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -