Unclear about Order of passing arguments while callng a function in C programming

Anonymous
2021-05-13T12:13:01.193+00:00

I want to know the preference order of passing arguments while calling a function in C programming. Actually i am getting different-different answer, so help me out. Here are the two sets of C program.

1-

include<stdio.h>

int main()
{
int a = 1;
printf("%d\t%d\t%d\n", a,++a, a++);
return 0;
}

2-

include<stdio.h>

int main()
{
int a = 1;
printf("%d\t%d\t%d\n", --a,++a, a++);
return 0;
}

3-

include<stdio.h>

int main()
{
int a = 5;
printf("%d\t%d\t%d\n", --a,++a,a--);
return 0;
}

Developer technologies | C++
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 49,551 Reputation points
    2021-05-13T12:26:09.833+00:00

    Here's a link to get you started reading about C and undefined behavior - why-are-these-constructs-using-pre-and-post-increment-undefined-behavior

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.