#include<stdio.h>
int main()
{
int a=3,post,pre;
post= a++ * a++ * a++;
a=3;
pre= ++a * ++a * ++a;
printf("post=%d pre=%d",post,pre);
return 0;
}
Answers were Sorted based on User's Feedback
Answer / manish
post= a++ * a++ * a++;
a++ is post increment so 3*3*3=27 and then a is incremented
pre= ++a * ++a * ++a;
++a pre increment
consider ++a * ++a
a incremented two times first result is 5 => 5*5=25
now we have 25 * ++a (a is 5)
a is again incremented (a become 6)
25 * 6 =150 ans
Is This Answer Correct ? | 7 Yes | 1 No |
void ( * abc( int, void ( *def) () ) ) ();
how to swap 3 nos without using temporary variable
write a c-program to display the time using FOR loop
main() { int i = 0xff ; printf("\n%d", i<<2); } a. 4 b. 512 c. 1020 d. 1024
main() { show(); } void show() { printf("I'm the greatest"); }
main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }
# include<stdio.h> aaa() { printf("hi"); } bbb(){ printf("hello"); } ccc(){ printf("bye"); } main() { int (*ptr[3])(); ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2](); }
void main() { int *mptr, *cptr; mptr = (int*)malloc(sizeof(int)); printf(ā%dā,*mptr); int *cptr = (int*)calloc(sizeof(int),1); printf(ā%dā,*cptr); }
main() { int i, j, *p; i = 25; j = 100; p = &i; // Address of i is assigned to pointer p printf("%f", i/(*p) ); // i is divided by pointer p } a. Runtime error. b. 1.00000 c. Compile error d. 0.00000
Write a complete program that consists of a function that can receive two numbers from a user (M and N) as a parameter. Then print all the numbers between the two numbers including the number itself. If the value of M is smaller than N, print the numbers in ascending flow. If the value of M is bigger than N, print the numbers in descending flow. may i know how the coding look like?
#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s; printf("%d",s->x); printf("%s",s->name); }
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.