C doesnt keep track of data types in memory you used the dirty trick of casting the pointer so it just remains as 0x401 in memory where the extra bits gets removed when you de ref. the new char ptr
Means it overwrites the value in memory when char ptr is assigned the address of int ptr ?
The opposite. It doesnt touch the value in memory
1. don't obscure your code. 2. Use a pasting website to share code. 3. you are doing a narrowing conversion, of course the value printed will be different 0x0401 will be seen as as 0x01 0x00000401 (big endian notation) is what it is stored as in memory. when you take a int pointer, it points to 0x00000401 when you take a char pointer, it points to 0x01, when you do (p0+1) it points to the next byte which is 0x04
https://pastebin.com/QYeQcjzy compiler is returning smile emoji as output of last two print statements . why ? it is the same code in C++.
@usernamestring
be patient, there is a reason why i haven't replied to you yet. I need to see the output myself.
Lol, what emoji do you see? a smiley face?
This-> 😄, or this-> 🙂 ?
Обсуждают сегодня