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
which type of aspect you want from the student.
Are pointers really faster than arrays?
How does struct work in c?
Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
Explain the use of 'auto' keyword in c programming?
What is %d called in c?
What are different types of pointers?
Why is it usually a bad idea to use gets()? Suggest a workaround.
How to throw some light on the b tree?
How is pointer initialized in c?
What is getch() function?
Write a program to find the biggest number of three numbers in c?
What are logical errors and how does it differ from syntax errors?
Explain what is wrong with this program statement?
What is the purpose of scanf() and printf() functions?