* Vs ++ precedence in C

前端 未结 4 1184
名媛妹妹
名媛妹妹 2021-01-24 03:44

I am not able to understand the output of the following C code :

#include
main()
{
   char * something = \"something\";
   printf(\"%c\", *someth         


        
4条回答
  •  暖寄归人
    2021-01-24 04:05

    always use the clockwise rule clockwise rule

    printf("%c\n", *something++);
    

    according to the rule you will first encounter * so get the value then ++ means increment

    enter image description here

    in the 3rd case printf("%c\n", *something++);

    enter image description here

    so according to the image increment the value ++ and then get the value *

提交回复
热议问题