The foll code gives o/p as
2310103
28
Now my doubt is why here 10 is printed two times although i m passing t=6 for the d parameter??

#include <stdio.h>
#include <string.h>


int f(int a, int b, int c,int d,int e)
{

printf("%d%d%d%d%d \n",a,b,c,d,e);
return a+b+c+d+e;
}
main()
{

int t;
printf("%d",f(2,(1,(2,(3))),t=10,t=6,3),6);
}

You are modifying "t" more than once between two sequence points which results in undefined behaviour.

Your printf() line of code is a great example of programmers being oh-so clever, while ignoring the virtue of clarity in their code.

If you had written that line of code for me, as your employer, I would give you one warning - and on the next occassion, FIRE YOU, immediately.

Programs are not gilded showcases for your mental gymnastics of code. When a program needs to be modified, de-bugged, or worked on by someone else, the value of being clear, rather than unnecessarily complex, will immediately become apparent.

Edited 3 Years Ago by Adak

Programs are not gilded showcases for your mental gymnastics of code. When a program needs to be modified, de-bugged, or worked on by someone else, the value of being clear, rather than unnecessarily complex, will immediately become apparent.

Thank you sir for your advice...actually i am a beginner in c..So i was studing some questions regarding the language when i came across this question..I am also familiar with the fact that such codes are never ever used in practical scenarios....Thanks again for your valuable advice..

printf("%d", expr);
printf("UINT:\t%u\tSYMBOL:%s\r\n", expr1, expr2);
// return type of expr, when evaluated, must match symbolic type given to printf ("%u, %s")
This question has already been answered. Start a new discussion instead.