What does =+ mean in C?

后端 未结 6 1663
说谎
说谎 2020-11-30 08:30

I came across =+ as opposed to the standard += today in some C code; I\'m not quite sure what\'s going on here. I also couldn\'t find it in the doc

6条回答
  •  感动是毒
    2020-11-30 09:13

    After reading your question I just investigated on these. Let me tell you what I have found. Tried it on gcc and turboc. Did not make it sure on Visual Studio as I have not installed it on my pC

      int main()
      { 
       int a=6;
       a =+ 2;
       printf("%d",a);
      }  o/p , a value is 2
    
      int main()
      {
       int a=6;
       a =- 2;
       printf("%d",a);
      } o/p , a value is -2 
    

    I dont know about the other answers as they said its an ancient version of C.But the modern compilers treat them as a value to be assigned ( thats positive or negative nothing more than that) and these below code makes me more sure about it.

      int main()
      { 
       int a=6;
       a =* 2;  \\ Reporting an error inavlid type of argument of unary *
       printf("%d",a);
      } 
     if *= is equal to =* then it should not report error but its throwing an error
    

提交回复
热议问题