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
Explain goto?
What is a void pointer? When is a void pointer used?
WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..
What are the ways to a null pointer can use in c programming language?
What is bash c?
How do I convert a string to all upper or lower case?
Explain the use of #pragma exit?
What is an lvalue?
praagnovation
When should structures be passed by values or by references?
What are the advantages and disadvantages of a heap?
Mention four important string handling functions in c languages .
hi any body pls give me company name interview conduct "c" language only
Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant
When would you use a pointer to a function?