What is the output of this C code?
#include
int main()
{
const int p;
p = 4;
printf("p is %d", p);
return 0;
}
Answer: B
Since the constant variable has to be declared and defined at the same time, not doing it results in an error.
Output:
$ cc pgm10.c
pgm10.c: In function ‘main’:
pgm10.c:5: error: assignment of read-only variable ‘p’
Enter details here
In C programming language, if the first and the second operands of operator + are of types int and float, respectively, the result will be of type
Answer: B
No answer description available for this question.
Enter details here
What is the output of the following 'C' program?
main()
{
extern int a;
printf("\n%d",a);
}
int a=20;
Answer: B
No answer description available for this question.
Enter details here
Choose the correct statements
Answer: D
No answer description available for this question.
Enter details here
Choose the correct statements
Answer: D
No answer description available for this question.
Enter details here
What is the output of this C code?
int main()
{
enum {ORANGE = 12, MANGO, BANANA = 11, APPLE};
printf("APPLE = %d\n", APPLE);
}
Answer: B
In enum, the value of constant is defined to the recent assignment from left.
Enter details here
Regarding the following statement which of the statements is true?
const int a = 100;
Answer: C
Because the const is used to declare non-changeable values only.
Enter details here
Comment on the output of this C code?
#include
int const print()
{
printf("Sanfoundry.com");
return 0;
}
void main()
{
print();
}
Answer: B
None.
Output:
$ cc pgm13.c
$ a.out
Enter details here
Which of the following statement is not true about preprocessor directives?
Answer: D
No terminating character required for preprocessor directives statements
Enter details here
Choose the correct statements
Answer: D
No answer description available for this question.
Enter details here