22 Aug 2013

Basic level c practice mathematical operation set 2

Note : All the programs are tested under Turbo C/C++ compilers. 
All the programs are tested on DOS environment, machine is an x86 system and compiled using Turbo C/C++ compiler
The program output may depend on the information based on this assumptions (for example sizeof(int) == 2 may be assumed).
Predict the output or error(s) for the following:

1.      #include<stdio.h>
void main()
{
            unsigned giveit=-1;
            int gotit;
            printf("%u ",++giveit);
            printf("%u \n",gotit=--giveit);
}
Answer:
 0 65535
Explanation:

3 comments: