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 / sharan
#include<stdio.h>
main()
{
char i=0;
for(;i>=0;i++) ;
printf("%d\n",i);
}
Here the CATCH is semicolon after for
so maximum positive value for the signed char is 127.
Hence it loops 127 times after that value of i wraps to
negative value that is -128.
Thus it prints -128.
| Is This Answer Correct ? | 11 Yes | 1 No |
Post New Answer View All Answers
What is a function simple definition?
How can you convert integers to binary or hexadecimal?
What is an auto keyword in c?
Explain the difference between getch() and getche() in c?
How can I handle floating-point exceptions gracefully?
write a program to rearrange the array such way that all even elements should come first and next come odd
Is a house a mass structure?
Explain how are 16- and 32-bit numbers stored?
Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?
What is the difference between āgā and āgā in C?
Explain how can I convert a number to a string?
What is extern variable in c with example?
Explain how can you tell whether two strings are the same?
How would you rename a function in C?
Why do some versions of toupper act strangely if given an upper-case letter?