#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

Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like.

21 Answers   ABC, eBay, Goldman Sachs, Google, HUP, Microsoft, TATA,


how to print 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 using any loop(for or while) only once(only 1 loop) and maximum 2 variables using C.

19 Answers   Cap Gemini, Infosys,


Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(int *arr[2])

1 Answers  


how can i cast a char type array to an int type array

2 Answers  


Give a one-line C expression to test whether a number is a power of 2.

10 Answers   Microsoft,






char inputString[100] = {0}; To get string input from the keyboard which one of the following is better? 1) gets(inputString) 2) fgets(inputString, sizeof(inputString), fp)

1 Answers  


program to Reverse a linked list

12 Answers   Aricent, Microsoft, Ness Technologies,


#include"math.h" void main() { printf("Hi everybody"); } if <stdio.h> will be included then this program will must compile, but as we know that when we include a header file in "" then any system defined function find its defination from all the directrives. So is this code of segment will compile? If no then why?

2 Answers  


void main() { int k=ret(sizeof(float)); printf("\n here value is %d",++k); } int ret(int ret) { ret += 2.5; return(ret); }

1 Answers  


main() { int i=4,j=7; j = j || i++ && printf("YOU CAN"); printf("%d %d", i, j); }

1 Answers  


void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(ā€œ%dā€,k); }

1 Answers  


Write a complete program that consists of a function that can receive two numbers from a user (M and N) as a parameter. Then print all the numbers between the two numbers including the number itself. If the value of M is smaller than N, print the numbers in ascending flow. If the value of M is bigger than N, print the numbers in descending flow. may i know how the coding look like?

2 Answers  


Categories