What is the output of the program given below

#include<stdio.h>
main()
{
char i=0;
for(;i>=0;i++) ;
printf("%d\n",i);
}

Answer Posted / gajanandon

after for there is semicolon...means empty statement. So no
effect of printf.
so for runs till i (char value) increments in positive
direction and terminates once it exceeds 127 (char
limitation).
Hence finally printf will execute and then prints -128.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between array and structure in c?

573


What is bash c?

552


Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.

832


What are 3 types of structures?

590


a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.

4540






How to Throw some light on the splay trees?

617


the question is that what you have been doing all these periods (one year gap)

1614


How do we make a global variable accessible across files? Explain the extern keyword?

1416


Is c object oriented?

536


How do you define a string?

649


Why void is used in c?

560


How we can insert comments in a c program?

627


what is the diffrenet bettwen HTTP and internet protocol

1383


How do I use strcmp?

634


Explain void pointer?

587