main( )

{

int a = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}};

printf(“%u %u %u %d \n”,a,*a,**a,***a);

printf(“%u %u %u %d \n”,a+1,*a+1,**a+1,***a+1);

}

Answers were Sorted based on User's Feedback

main( ) { int a = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}}; printf(�..

100 100 100 2
124 108 104 3

 Is This Answer Correct ? 2 Yes 1 No

main( ) { int a = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}}; printf(�..

100, 100, 100, 2

114, 104, 102, 3

Explanation:

The given array is a 3-D one. It can also be viewed as a
1-D array.

2
4
7
8
3
4
2
2
2
3
3
4
100 102 104 106 108 110 112 114 116 118
120 122

thus, for the first printf statement a, *a, **a give
address of first element . since the indirection ***a gives
the value. Hence, the first line of the output.

for the second printf a+1 increases in the third dimension
thus points to value at 114, *a+1 increments in second
dimension thus points to 104, **a +1 increments the first
dimension thus points to 102 and ***a+1 first gets the value
at first location and then increments it by 1. Hence, the
output.

 Is This Answer Correct ? 9 Yes 12 No

More C Code Interview Questions

Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)

Write a program that reads a dynamic array of 40 integers and displays only even integers

why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?

main() { char not; not=!2; printf("%d",not); }

int aaa() {printf(“Hi”);} int bbb(){printf(“hello”);} iny ccc(){printf(“bye”);} main() { int ( * ptr) (); ptr = aaa; ptr = bbb; ptr =ccc; ptr(); }

Is the following code legal? typedef struct a { int x; aType *b; }aType

write a c program to Create a registration form application by taking the details like username, address, phone number, email along with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 5 users and display the details. In place of password display “****”. (Use Structures).

main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }

main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }

main() { int i; float *pf; pf = (float *)&i; *pf = 100.00; printf("\n %d", i); } a. Runtime error. b. 100 c. Some Integer not 100 d. None of the above

main() { if (!(1&&0)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above

Categories
• C Code (421)
• C++ Code (127)
• VC++ Code (17)
• Java Code (84)
• Dot Net Code (114)
• Visual Basic Code (11)
• Programming Code AllOther (62)