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 |
main() { int i=-1; -i; printf("i = %d, -i = %d \n",i,-i); }
find A^B using Recursive function
Is the following code legal? void main() { typedef struct a aType; aType someVariable; struct a { int x; aType *b; }; }
write a c program to Create employee record by taking details like name, employee id, address and phone number. While taking the phone number, take either landline or mobile number. Ensure that the phone numbers of the employee are unique. Also display all the details
main() { int i, n; char *x = “girl”; n = strlen(x); *x = x[n]; for(i=0; i<n; ++i) { printf(“%s\n”,x); x++; } }
{ int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }
write a program to find out roots of quadratic equation "x=-b+-(b^2-4ac0^-1/2/2a"
Code for 1>"ascii to string" 2>"string to ascii"
1 Answers Aricent, Global Logic,
what is the output of following program ? void main() { int i=5; printf("%d %d %d %d %d ",i++,i--,++i,--i,i); }
Display the time of the system and display the right time of the other country
1) int i=5; j=i++ + i++ + i++; printf("%d",j);This code gives the answer 15.But if we replace the value of the j then anser is different?why? 2)int i=5; printf("%d",i++ + i++ + i++); this givs 18.
main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }