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
How are variables declared in c?
1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.
Write a Program to find whether the given number or string is palindrome.
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.
Explain the difference between call by value and call by reference in c language?
Explain what is the difference between the expression '++a' and 'a++'?
What is the advantage of c?
What are the different types of constants?
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
What is the explanation for prototype function in c?
How can I sort more data than will fit in memory?
Explain what are the different file extensions involved when programming in c?
Is it better to use malloc() or calloc()?
What is fflush() function?