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 bash c?

548


What is the difference between exit() and _exit() function?

592


a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

625


What does c mean before a date?

581


How many types of functions are there in c?

576






Can the sizeof operator be used to tell the size of an array passed to a function?

608


Explain what is the difference between text files and binary files?

604


What are extern variables in c?

538


What is d'n in c?

622


What is the difference between ā€˜gā€™ and ā€œgā€ in C?

2493


What does %c do in c?

578


What do you mean by c what are the main characteristics of c language?

560


When c language was developed?

628


Explain what is the difference between #include and #include 'file' ?

571


What is advantage of pointer in c?

681