int i =10
main()
{
int i =20,n;
for(n=0;n<=i;)
{
int i=10
i++;
}
printf("%d", i);

Answer Posted / guest

the print would be 20.

the problem is about scope. the first i=10 is global scope.
But inside main() comes function scope. So i=20. The i
inside the for loop is of block scope and does not affect
the i outside it.

Is This Answer Correct ?    5 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the properties of union. What is the size of a union variable

920


What is size of union in c?

752


please explain every phase in the "SDLC" in the dotnet.

2385


What is the size of enum in bytes?

791


What is the difference between scanf and fscanf?

877


What is the purpose of realloc()?

876


What is dangling pointer in c?

812


Describe the modifier in c?

864


Explain heap and queue.

801


Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?

802


How do you initialize pointer variables?

799


Explain the use of 'auto' keyword

875


What is the right type to use for boolean values in c? Is there a standard type?

786


What is s or c?

789


Explain what are preprocessor directives?

817