adplus-dvertising
frame-decoration

Question

Comment on the output of this C code?
#include <stdio.h>
    int main()
    {
        int i;
        for (i = 0;i < 5; i++)
        int a = i;
        printf("%d", a);
    }

a.

a is out of scope when printf is called

b.

Redeclaration of a in same scope throws error

c.

Syntax error in declaration of a

d.

No errors, program will show the output 5

Posted under C Programming

Answer: (c).Syntax error in declaration of a

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Comment on the output of this C code? #include <stdio.h> int main() { int i; for (i = 0;i < 5; i++) int a = i; printf("%d",...

Similar Questions

Discover Related MCQs

Q. Array sizes are optional during array declaration by using ______ keyword.

Q. Which of following is not accepted in C?

Q. Which of the following cannot be static in C?

Q. Functions have static qualifier for its declaration by default.

Q. Is initialisation mandatory for local static variables?

Q. Assignment statements assigning value to local static variables are executed only once

Q. What is the format identifier for “static a = 20.5;”?

Q. Which of the following is true for static variable?

Q. register keyword mandates compiler to place it in machine register.

Q. Register storage class can be specified to global variables

Q. Which among the following is wrong for “register int a;” ?

Q. When compiler accepts the request to use the variable as a register?

Q. Which data type can be stored in register?

Q. Which of the following operation is not possible in a register variable?

Q. Which among the following is the correct syntax to declare a static variable register?

Q. Register variables reside in

Q. The scope of an automatic variable is:

Q. Automatic variables are allocated space in the form of a:

Q. Which of the following is a storage specifier?

Q. Default storage class if not any is specified for a local variable, is auto