main()
{
int i=_l_abc(10);
printf("%d\n",--i);
}
int _l_abc(int i)
{
return(i++);
}
Answers were Sorted based on User's Feedback
Answer / susie
Answer :
9
Explanation:
return(i++) it will first return i and then increments. i.e.
10 will be returned.
Is This Answer Correct ? | 7 Yes | 1 No |
Post increment - perform operation first , then increment
In function call _l_abc its post increment, so after value 10 to be returned is decided , local variable i is increment , its i in function.
Variable i in _l_abc is different than i in main.
Post decrement : decrement first then perform operation.
In main its pre decrement , returned 10 is decremented to 9, then printed.
Now , unless compiler does not throw error of beginning function name with _ , 9 is printed.
Is This Answer Correct ? | 1 Yes | 1 No |
void main() { unsigned giveit=-1; int gotit; printf("%u ",++giveit); printf("%u \n",gotit=--giveit); }
what is the output of the below program & why ? #include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); }
main() { extern int i; i=20; printf("%d",sizeof(i)); }
#define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12)); }
Write a program using one dimensional array to assign values and then display it on the screen. Use the formula a[i]=i*10 to assign value to an element.
1 Answers Samar State University,
main() { struct date; struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }
#if something == 0 int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }
plz send me all data structure related programs
4. Main() { Int i=3,j=2,c=0,m; m=i&&j||c&I; printf(“%d%d%d%d”,I,j,c,m); }
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)); }
main(int argc, char *argv[]) { (main && argc) ? main(argc-1, NULL) : return 0; } a. Runtime error. b. Compile error. Illegal syntax c. Gets into Infinite loop d. None of the above
print a semicolon using Cprogram without using a semicolon any where in the C code in ur program!!
35 Answers Tata Elxsi, TCS, VI eTrans,