Lesson Never Get It (C)

IRC Channel :

<Sebastian> The * is significant. I have told you this before.
<Sebastian> MiB: What is sizeof (char)? What is sizeof "Command"? From the answer to these two questions, can you say that "Command" is a char?
<MiB> Sebastian, wow is it sizeof ?? thing
<Sebastian> MiB: Argument 2 needs to be something like "Command", which is not an int, not a char... It is something else.
<Sebastian> ,cc sizeof (char)
<candide> Sebastian: no output: sizeof(char) = 1
<MiB> Sebastian, okay not "int" not "char"
<Sebastian> MiB: { sizeof "Command" }
<candide> MiB: no output: sizeof "Command" = 8
<Sebastian> The error message tells you something about 'char *'... Let's see if that might work?
<Sebastian> MiB: { char *cmd = "Command"; sizeof cmd }
<candide> MiB: no output: sizeof cmd = 8; cmd = 0x4020c4 "Command"
<Sebastian> MiB: { char *cmd = "A different sized command"; sizeof cmd /* Coincidentally, the size was the same this time. Be careful with that one. Don't say you weren't warned. */ }
<candide> MiB: no output: cmd = 0x4020b0 "A different sized command" 

Comments

Popular Posts