1,717 views
2 votes
2 votes
main()

{

char a[2][3][3] = {'g','a','t','e','s','q','u','I','z'};

printf("%s",**a);

the answer is gatequiz, to refer to a 3dimensional array the printf statement should be ***a right?

1 Answer

0 votes
0 votes

answer is correct .

It will printf 'gatesquiz', because **a is giving the starting address of the first character and therefore 'printf ' will take the starting address and will print 'gatesquiz'

but it you use ***a , it will give the value stored at first address i'e 'g' and hece will print( ***a ) will print 'g' on the console.

You can also verify it here http://code.geeksforgeeks.org/XyBn7I

edited by

No related questions found