Question
#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);
}
Question Submitted By :: Susie
I also faced this Question!!
Rank
Answer Posted By
Re: #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);
}
Answer
# 1
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.
Susie
Other C Code Interview Questions
Question Asked @ Answers main(int argc, char **argv)
{
printf("enter the character");
getchar();
sum(argv[1],argv[2]);
}
sum(num1,num2)
int num1,num2;
{
return num1+num2;
} 1 #define DIM( array, type) sizeof(array)/sizeof(type)
main()
{
int arr[10];
printf(“The dimension of the array is %d”, DIM(arr,
int));
} 1 main()
{
printf("%d, %d", sizeof('c'), sizeof(100));
}
a. 2, 2
b. 2, 100
c. 4, 100
d. 4, 4 HCL 3 main( )
{
int a[2][3][2] = {{{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);
} 1 main(){
char a[100];
a[0]='a';a[1]]='b';a[2]='c';a[4]='d';
abc(a);
}
abc(char a[]){
a++;
printf("%c",*a);
a++;
printf("%c",*a);
} 1 main()
{
int a=10,*j;
void *k;
j=k=&a;
j++;
k++;
printf("\n %u %u ",j,k);
} 1 main()
{
char name[10],s[12];
scanf(" \"%[^\"]\"",s);
}
How scanf will execute? 1 main()
{
char * strA;
char * strB = I am OK;
memcpy( strA, strB, 6);
}
a. Runtime error.
b. I am OK
c. Compile error
d. I am O HCL 2 main()
{
int i =0;j=0;
if(i && j++)
printf("%d..%d",i++,j);
printf("%d..%d,i,j);
} 1 main()
{
register int a=2;
printf("Address of a = %d",&a);
printf("Value of a = %d",a);
} 1 How to access command-line arguments? 4 #if something == 0
int some=0;
#endif
main()
{
int thing = 0;
printf("%d %d\n", some ,thing);
} 1 main()
{
char a[4]="HELLO";
printf("%s",a);
} 1 Write a function to find the depth of a binary tree. Adobe 8 main()
{
signed int bit=512, i=5;
for(;i;i--)
{
printf("%d\n", bit = (bit >> (i - (i -1))));
}
}
a. 512, 256, 128, 64, 32
b. 256, 128, 64, 32, 16
c. 128, 64, 32, 16, 8
d. 64, 32, 16, 8, 4 HCL 1 main()
{
printf("\nab");
printf("\bsi");
printf("\rha");
} 1 main()
{
static int a[3][3]={1,2,3,4,5,6,7,8,9};
int i,j;
static *p[]={a,a+1,a+2};
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d\t%d\t%d\t%d\n",*(*(p+i)+j),
*(*(j+p)+i),*(*(i+p)+j),*(*(p+j)+i));
}
} 1 main()
{
void swap();
int x=10,y=8;
swap(&x,&y);
printf("x=%d y=%d",x,y);
}
void swap(int *a, int *b)
{
*a ^= *b, *b ^= *a, *a ^= *b;
} 1 programming in c lanugaue programm will errror error with
two header file one as stdio.h and other one is conio.h 1 main()
{
char i=0;
for(;i>=0;i++) ;
printf("%d\n",i);
} 1 For more C Code Interview Questions Click Here