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
Explain the properties of union. What is the size of a union variable
What is size of union in c?
please explain every phase in the "SDLC" in the dotnet.
What is the size of enum in bytes?
What is the difference between scanf and fscanf?
What is the purpose of realloc()?
What is dangling pointer in c?
Describe the modifier in c?
Explain heap and queue.
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
How do you initialize pointer variables?
Explain the use of 'auto' keyword
What is the right type to use for boolean values in c? Is there a standard type?
What is s or c?
Explain what are preprocessor directives?