Home > Back-end >  Solving a c language problem
Solving a c language problem

Time:06-05

#include

Int main ()
{
Int a, k=4, m=6, * p=& amp; K, * p2=& amp; m;
A=p1==& amp; m;
Printf (" % d \ n ", a);
return 0;
}
Why this program, the results last a=0!
Two equals sign is not equivalent to delimit, etc and then assigned to a...
To solve the

CodePudding user response:

A=p1==& amp; m;
This line of code that conditions are not set up
First the p1==& amp; M, conditions are not established, 0
And then a=0; \
So that a value is 0
A=(p1==& amp; m);

CodePudding user response:

This is the problem of operator precedence, the priority is higher than of===

CodePudding user response:

I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related