Function Parameter Evaluation Order in C

June 24, 2005
It's worth noting that parameter expressions are evaluated like everything else from right to left. Of course, this only matters when passing at least one argument expression to a function that may change the value of another argument.
#include <stdio.h>
void func(int a, int b, int c, int d)
	printf("%d %d %d %d\\n",a,b,c,d);
int main()
	int x = 0;
	return 0;
Results in the following:
4 3 2 1

Related Posts

1 Comment

Comment March 28, 2006 by anonymous
It is not guaranteed. Different compilers may produce different output.