Home > Back-end >  C language pointer problem (second-year rookie)
C language pointer problem (second-year rookie)

Time:09-27

#include

Int main ()
{int a=0, * p;
P=& amp; a;
A=(* p) + +;
Printf (" % d % d ", a, p);
return 0;
}
Why the output of the process is 00, instead of 11?

CodePudding user response:

A=(+ + (* p));
This writing

CodePudding user response:

reference 1/f, guiyang horse Ma Shanfu plugging waterproof engineering professional maintenance of swimming pool response:
a=(+ + (* p));
This

The
reference
a=(* p) + +;

In C language are undefined behavior result doesn't make sense

CodePudding user response:

Rear + + is the first operation again + +, that is to say, the next call to + +,

CodePudding user response:

Compile environment? VS2015 ran 11

CodePudding user response:

VS2017 ran 11, may the GCC compiler result is 00,
Rear + + operator precedence above=, so the last step should be to give a value assignment of 0, arguably, the result is 00,
https://c.runoob.com/compile/11 online compilation, the result is 00,
Don't waste your time to study these young people, try to avoid this kind of writing (different compiler results),
  • Related