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 far pointer in c?
What is pointers in c?
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)
Is main an identifier in c?
Can a local variable be volatile in c?
Suppose we have a table name EMP as below. We want to perform a operation in which, I want to change name ‘SMITH’ from as ‘SMITH JAIN’. Also I want to change the name of the column from ENAME to E_NAME. EMPNO ENAME JOB MGR HIREDATE SAL 7369 SMITH Coder 7902 17-DEC-80 800 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 7521 WARD SALESMAN 7698 22-FEB-81 1250
is it possible to create your own header files?
How can you convert integers to binary or hexadecimal?
What extern c means?
Where are the auto variables stored?
Here is a good puzzle: how do you write a program which produces its own source code as output?
What is %g in c?
What is the maximum no. of arguments that can be given in a command line in C.?
What are reserved words with a programming language?
Can 'this' pointer by used in the constructor?