The following program reports an error on compilation.
#include
int main()
{
float i=10, *j;
void *k;
k=&i;
j=k;
printf("%f\n", *j);
return 0;
}
Answer: B
This program will NOT report any error. (Tested in Turbo C under DOS and GCC under Linux)
The output: 10.000000
Enter details here
What is (void*)0?
Answer: A
No answer description available for this question.
Enter details here
What will be the output of the program ?
#include
#include
int main()
{
int i, n;
char *x="Alice";
n = strlen(x);
*x = x[n];
for(i=0; i<=n; i++)
{
printf("%s ", x);
x++;
}
printf("\n", x);
return 0;
}
Answer: D
No answer description available for this question.
Enter details here
Which of the following does not initialize ptr to null (assuming variable declaration of a as int a=0)?
Answer: A
No answer description available for this question.
Enter details here
What is the output of this C code?
void main()
{
int k = 5;
int *p = &k;
int **m = &p;
**m = 6;
printf("%d\n", k);
}
Answer: C
No answer description available for this question.
Enter details here
What is the output of this C code?
int main()
{
int a = 1, b = 2, c = 3;
int *ptr1 = &a, *ptr2 = &b, *ptr3 = &c;
int **sptr = &ptr1; //-Ref
*sptr = ptr2;
}
Answer: B
No answer description available for this question.
Enter details here
What will be the output of the program ?
#include
int main()
{
char *str;
str = "%s";
printf(str, "K\n");
return 0;
}
Answer: C
No answer description available for this question.
Enter details here
What will be the output of the program assuming that the array begins at location 1002?
#include
int main()
{
int a[2][3][4] = { {1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 2},
{2, 1, 4, 7, 6, 7, 8, 9, 0, 0, 0, 0} };
printf("%u, %u, %u, %d\n", a, *a, **a, ***a);
return 0;
}
Answer: C
No answer description available for this question.
Enter details here
The operator used to get value at address stored in a pointer variable is
Answer: A
No answer description available for this question.
Enter details here
What is the output of this C code?
int main()
{
int i = 10;
void *p = &i;
printf("%d\n", (int)*p);
return 0;
}
Answer: A
No answer description available for this question.
Enter details here