+ 1
{solved} Need help with this output - C language
What is the output of this code? (assuming 8 byte pointers) const char firstname[] = "dev"; const char* lastname = "programmer"; printf("%lu\n", sizeof(firstname) + sizeof(lastname)); Edit: I am not sure of this but for dev it can be 3 char each of 1byte + one \0 of 1 byte so the size is 4
5 odpowiedzi
+ 3
The output is the following:
https://code.sololearn.com/cevQ5CQA1T9B/?ref=app
For knowing an output just copy and paste it on a code playground in your profile.
Btw hope that I helped you 😄
Edited:
Saithama
Btw sorry, I dont know, sorry for wrong understanding your question.
+ 1
Coder Kitten My bad since sizeof operator has the firstname passed to it i assumed it would output the char ptr size and not the array size
this was interesting!
0
MΛƬƬΣӨ Sorry I meant how do we arrive at the output?
what does 8byte (64bit) pointer mean?
Edit: No issues
I am not sure of this but for dev it can be
3 char each of 1byte + one \0 of 1 byte so the size is 4
but i dont understand how its done for programmer