#include<stdio.h>

main()

{

int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} };

int *p,*q;

p=&a[2][2][2];

*q=***a;

printf("%d----%d",*p,*q);

}



#include<stdio.h> main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; ..

Answer / susie

Answer :

SomeGarbageValue---1

Explanation:

p=&a[2][2][2] you declare only two 2D arrays,
but you are trying to access the third 2D(which you are not
declared) it will print garbage values. *q=***a starting
address of a is assigned integer pointer. Now q is pointing
to starting address of a. If you print *q, it will print
first element of 3D array.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C Code Interview Questions

In a gymnastic competition, scoring is based on the average of all scores given by the judges excluding the maximum and minimum scores. Let the user input the number of judges, after that, input the scores from the judges. Output the average score. Note: In case, more than two judges give the same score and it happens that score is the maximum or minimum then just eliminate two scores. For example, if the number of judges is 5 and all of them give 10 points each. Then the maximum and minimum score is 10. So the computation would be 10+10+10, this time. The output should be 10 because 30/3 is 10.

0 Answers   TCS,


main( ) { int a[ ] = {10,20,30,40,50},j,*p; for(j=0; j<5; j++) { printf(“%d” ,*a); a++; } p = a; for(j=0; j<5; j++) { printf(“%d ” ,*p); p++; } }

1 Answers  


#include<stdio.h> main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d..%d",*p,*q); }

1 Answers  


main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }

2 Answers   IBM,


Hi, i have a project that the teacher want a pyramid of numbers in C# or java...when we click a button...the pyramid should be generated in a listbox/or JtextArea...and the pyramid should have the folowing form: 1 232 34543 4567654 567898765 67890109876 7890123210987 890123454321098 90123456765432109 0123456789876543210 Plz help with codes...didn't find anything on the net.

0 Answers  






main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; printf("\n%d %d %d",a,*f1,*f2); }

6 Answers  


main() { static int var = 5; printf("%d ",var--); if(var) main(); }

1 Answers  


#define a 10 int main() { printf("%d..",a); foo(); printf("%d..",a); return 0; } void foo() { #undef a #define a 50 }

3 Answers  


main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }

2 Answers   HP,


main() { int i = 3; for (;i++=0;) printf(“%d”,i); }

1 Answers   CSC,


C program to print magic square of order n where n > 3 and n is odd

2 Answers   Accenture,


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

0 Answers  


Categories