void main()
{
int a=1;
printf("%d %d %d",a,++a,a++);
}
the output is supposed to be 1 2 2....but it is 3 3 1
this is due to calling conventions of C. if anyone can
explain me how it happens?

Answer Posted / vishnu

first calculations will be done from right to left and then
prints accroding to the parameters passed.

Is This Answer Correct ?    29 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the 5 data types?

591


What are the advantages of union?

619


Why pointers are used in c?

576


how do you execute a c program in unix.

631


What is derived datatype in c?

627






Where in memory are my variables stored?

623


typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none

703


What is void pointers in c?

578


What is difference between arrays and pointers?

573


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

621


What does %c do in c?

578


How many main () function we can have in a project?

602


The file stdio.h, what does it contain?

656


Explain what header files do I need in order to define the standard library functions I use?

641


Is main is user defined function?

584