Close
Close

what would be the output of:

   Anubha03

#include

int main()

{

int a = 5;

int b,c;

if (a==4)

{

b = 6;

c = 7;

}

printf("%d %d\n",b,c);

}


Answers

  •    Aakhya Singh

    Since the value of a is not 4, the body of if will not be executed. Hence, the variables b and c are not initialized.

    In C, the value of any uninitialized variable is undefined, which means that an uninitialized variable can take any value. So on printing b and c, you will get undefined values. Some compilers assign 0 as the value for uninitialized variables and so will show the output as 0 for both the variables. 



Ask Yours
Post Yours
Write your answer