What is the output of the program given below
main()
{
signed char i=0;
for(;i>=0;i++) ;
printf("%d\n",i);
}
Answer / susie
Answer :
-128
Explanation
Notice the semicolon at the end of the for loop. THe initial
value of the i is set to 0. The inner loop executes to
increment the value from 0 to 127 (the positive range of
char) and then it rotates to the negative value of -128. The
condition in the for loop fails and so comes out of the for
loop. It prints the current value of i that is -128.
| Is This Answer Correct ? | 2 Yes | 1 No |
Which version do you prefer of the following two, 1) printf(“%s”,str); // or the more curt one 2) printf(str);
void main() { int i=i++,j=j++,k=k++; printf(“%d%d%d”,i,j,k); }
to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD
Write a program that reads a dynamic array of 40 integers and displays only even integers
#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }
struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); }
main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }
#define prod(a,b) a*b main() { int x=3,y=4; printf("%d",prod(x+2,y-1)); }
String copy logic in one line.
#define SQR(x) x * x main() { printf("%d", 225/SQR(15)); } a. 1 b. 225 c. 15 d. none of the above
Display the time of the system and display the right time of the other country
find A^B using Recursive function