Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the size of structure in c?

1175


What are examples of structures?

1130


What is the difference between int main and void main in c?

1192


Explain what is a pragma?

1063


What is pointers in c with example?

1093


What is indirection in c?

1083


What is f'n in math?

1089


What are # preprocessor operator in c?

1127


what is a function method?give example?

2381


How to get string length of given string in c?

1073


What is the difference between procedural and functional programming?

1091


Does sprintf put null character?

1055


Explain what are the standard predefined macros?

1134


Differentiate between Macro and ordinary definition.

1404


What is the difference between a function and a method in c?

1097