What is the output of this C code?
void main()
{
int k = 5;
int *p = &k;
int **m = &p;
printf("%d%d%d\n", k, *p, **p);
}
Answer: D
No answer description available for this question.
Enter details here
What will be the output of the program ?
#include
int main()
{
char str[20] = "Hello";
char *const p=str;
*p='M';
printf("%s\n", str);
return 0;
}
Answer: A
No answer description available for this question.
Enter details here
What will be the output of the following C code?
#include
int main()
{
int i = 10;
int *p = &i;
foo(&p);
printf("%d ", *p);
printf("%d ", *p);
}
void foo(int **const p)
{
int j = 11;
*p = &j;
printf("%d ", **p);
}
Answer: B
No answer description available for this question.
Enter details here
Comment on the following?
const int *ptr;
Answer: A
No answer description available for this question.
Enter details here
What is the output of this C code?
int main()
{
int i = 97, *p = &i;
foo(&i);
printf("%d ", *p);
}
void foo(int *p)
{
int j = 2;
p = &j;
printf("%d ", *p);
}
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("%f\n", *(float*)p);
return 0;
}
Answer: D
No answer description available for this question.
Enter details here
What will be the output of the following C code?
#include
void foo(float *);
int main()
{
int i = 10, *p = &i;
foo(&i);
}
void foo(float *p)
{
printf("%f\n", *p);
}
Answer: B
No answer description available for this question.
Enter details here
Will the program compile?
#include
int main()
{
char str[5] = "IndiaBIX";
return 0;
}
Answer: A
C doesn't do array bounds checking at compile time, hence this compiles.
But, the modern compilers like Turbo C++ detects this as 'Error: Too many initializers'.
GCC would give you a warning.
Enter details here
What is the output of this C code?
int *f();
int main()
{
int *p = f();
printf("%d\n", *p);
}
int *f()
{
int j = 10;
return &j;
}
Answer: A
No answer description available for this question.
Enter details here