Hi all

here is small C program
main()
{
int i=2;
printf("%d\n",++i * ++i * ++i * ++i);
}

it gives o/p 480 why..?

Thanks for u r reply.
shalin

Recommended Answers

All 3 Replies

it is wrong to do such expression (assign the same variable (i) in a single operation more than onetime) it gives a machine dependent result

Actually this kind of problems are compiler dependent. Try in different types of compilers. You will see different answers.

hi shalin
i run ur programme and getting o/p 360...plz check ur programme oncagain

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.