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
What does 1f stand for?
Why do some versions of toupper act strangely if given an upper-case letter?
Explain what are header files and explain what are its uses in c programming?
How do I read the arrow keys? What about function keys?
What are the advantages of using new operator as compared to the function malloc ()?
Why array is used in c?
How do c compilers work?
Write program to remove duplicate in an array?
Can you please explain the difference between malloc() and calloc() function?
Why functions are used in c?
How can I invoke another program or command and trap its output?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
Explain what is a pragma?
how to execute a program using if else condition and the output should enter number and the number is odd only...
What is the difference between scanf and fscanf?