Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (anonymous):

In C language, I want to print 2d array elements using pointers. I used this code : for(i=0;i<3;i++){ for(j=0;j<3;j++){ printf("%d \t",*(*(p+i)+j)); } printf("\n"); } But the compiler says : error : invalid type argument of unary '*' (have 'int') How to solve this?

OpenStudy (rsmith6559):

Whichever j you want, it would be found by adding: p + ( max( i ) * sizeof( j ) ) + ( sizeof( j ) * j ) and dereferencing the total.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!