What is the output of this C code?
void main()
{
m();
m();
}
void m()
{
static int x = 5;
x++;
printf("%d", x);
}
Answer: A
No answer description available for this question.
Enter details here
What is the output of this C code?
int foo();
int main()
{
int i = foo();
}
foo()
{
printf("2 ");
return 2;
}
Answer: A
No answer description available for this question.
Enter details here
What is the output of this C code?
void main()
{
static int x = 3;
x++;
if (x <= 5)
{
printf("hi");
main();
}
}
Answer: D
No answer description available for this question.
Enter details here
Which of the following function declaration is illegal?
Answer: D
No answer description available for this question.
Enter details here
The keyword used to transfer control from a function back to the calling function is
Answer: D
No answer description available for this question.
Enter details here
What will be the output?
int main()
{
printf("%d", d++);
}
int d = 10;
Answer: D
No answer description available for this question.
Enter details here
The keyword used to transfer control from a function back to the calling function is
Answer: D
The keyword return is used to transfer control from a function back to the calling function.
Example:
#include
int add(int, int); /* Function prototype */
int main()
{
int a = 4, b = 3, c;
c = add(a, b);
printf("c = %d\n", c);
return 0;
}
int add(int a, int b)
{
/* returns the value and control back to main() function */
return (a+b);
}
Output: c = 7
Enter details here
What is the output of this C code?
int x = 5;
void main()
{
int x = 3;
printf("%d", x);
{
int x = 4;
}
printf("%d", x);
}
Answer: A
No answer description available for this question.
Enter details here
What will happen after compiling and running following code?
main()
{
printf("%p", main);
}
Answer: C
Function names are just addresses (just like array names are addresses).
main() is also a function. So the address of function main will be printed. %p in printf specifies that the argument is an address. They will be printed as hexadecimal numbers.
Enter details here
Functions in C are ALWAYS:
Answer: B
No answer description available for this question.
Enter details here