How is printf statement interpreted?

后端 未结 5 1246
耶瑟儿~
耶瑟儿~ 2020-12-06 11:39

How is the following line interpreted by GCC compiler:

printf(\"HELLO\");  

I want to know this because when I am running following program

5条回答
  •  温柔的废话
    2020-12-06 12:11

    It advances the input pointer by 5 bytes and hence skips the word "Good".

    This is pointer arithmetic in C.

    Lets assume base pointer of the string "Good Morning" is p, and 5+p =p+5 and it points to letter M.

    Hence the input to printf is the pointer from the letter M.

提交回复
热议问题