Warning: comparison with string literals results in unspecified behaviour

后端 未结 7 2419
终归单人心
终归单人心 2020-12-05 01:52

I am starting a project of writing a simplified shell for linux in C. I am not at all proficient with C nor with Linux that\'s exactly the reason I decided it would be a goo

7条回答
  •  再見小時候
    2020-12-05 02:35

    There is a distinction between 'a' and "a":

    • 'a' means the value of the character a.
    • "a" means the address of the memory location where the string "a" is stored (which will generally be in the data section of your program's memory space). At that memory location, you will have two bytes -- the character 'a' and the null terminator for the string.

提交回复
热议问题