main()
{
char i=0;
for(;i>=0;i++) ;
printf("%d\n",i);
}
Answers were Sorted based on User's Feedback
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 |
main() { int i =0;j=0; if(i && j++) printf("%d..%d",i++,j); printf("%d..%d,i,j); }
main() { int i = 100; clrscr(); printf("%d", sizeof(sizeof(i))); } a. 2 b. 100 c. 4 d. none of the above
int swap(int *a,int *b) { *a=*a+*b;*b=*a-*b;*a=*a-*b; } main() { int x=10,y=20; swap(&x,&y); printf("x= %d y = %d\n",x,y); }
How do you write a program which produces its own source code as its output?
void pascal f(int i,int j,int k) { printf(“%d %d %d”,i, j, k); } void cdecl f(int i,int j,int k) { printf(“%d %d %d”,i, j, k); } main() { int i=10; f(i++,i++,i++); printf(" %d\n",i); i=10; f(i++,i++,i++); printf(" %d",i); }
You are given any character string. Find the number of sets of vowels that come in the order of aeiou in the given string. For eg., let the given string be DIPLOMATIC. The answer returned must be "The number of sets is 2" and "The sets are "IO and AI". Vowels that form a singleton set must be neglected. Try to post the program executable in gcc or g++ or in java.
What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++<n) p = &arr[i]; *p = 0; }
main() { char a[4]="HELL"; printf("%s",a); }
void main() { int x,y=2,z; z=(z*=2)+(x=y=z); printf("%d",z); }
Write a C program to print look and say sequence? For example if u get the input as 1 then the sequence is 11 21 1211 111221 312211 12112221 .......(it counts the no. of 1s,2s etc which is in successive order) and this sequence is used in run-length encoding.
main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }
main() { printf("%d", out); } int out=100;