main()

{

char i=0;

for(;i>=0;i++) ;

printf("%d\n",i);

}

Answers were Sorted based on User's Feedback



main() { char i=0; for(;i>=0;i++) ; print..

Answer / mickey

-128

Is This Answer Correct ?    14 Yes 3 No

main() { char i=0; for(;i>=0;i++) ; print..

Answer / susie

Answer :

Behavior is implementation dependent.

Explanation:

The detail if the char is signed/unsigned by default
is implementation dependent. If the implementation treats
the char to be signed by default the program will print –128
and terminate. On the other hand if it considers char to be
unsigned by default, it goes to infinite loop.

Rule:

You can write programs that have implementation
dependent behavior. But dont write programs that depend on
such behavior.

Is This Answer Correct ?    5 Yes 2 No

Post New Answer

More C Code Interview Questions

main() { float f=5,g=10; enum{i=10,j=20,k=50}; printf("%d\n",++k); printf("%f\n",f<<2); printf("%lf\n",f%g); printf("%lf\n",fmod(f,g)); }

1 Answers  


how to return a multiple value from a function?

5 Answers   Wipro,


write a c program to print magic square of order n when n>3 and n is odd?

1 Answers   HCL,


main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }

3 Answers   GNITC,


Write, efficient code for extracting unique elements from a sorted list of array. e.g. (1, 1, 3, 3, 3, 5, 5, 5, 9, 9, 9, 9) -> (1, 3, 5, 9).

13 Answers   Intel, Microsoft, TCS,






write a c-program to find gcd using recursive functions

5 Answers   HTC, Infotech,


programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h

1 Answers  


How do you sort a Linked List (singly connected) in O(n) please mail to pawan.10k@gmail.com if u can find an anser...i m desperate to knw...

6 Answers   Microsoft, MSD, Oracle,


main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }

3 Answers  


main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }

2 Answers   HP,


Write a C function to search a number in the given list of numbers. donot use printf and scanf

5 Answers   Honeywell, TCS,


To reverse an entire text file into another text file.... get d file names in cmd line

0 Answers   Subex,


Categories