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
In C language, a variable name cannot contain?
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
What is difference between structure and union?
How can I get random integers in a certain range?
WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..
i got 75% in all semester am i eligible for your company
What does sizeof function do?
i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical
When should I declare a function?
What is c++ used for today?
What is wrong with this statement? Myname = 'robin';
List some of the dynamic data structures in C?
What are structure types in C?
What is the difference between malloc calloc and realloc in c?