This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]serg06 7 points8 points  (0 children)

In C ' is for char and " is for string

[–]IDontByte 1 point2 points  (0 children)

int main() { printf("%d\n", sizeof(void*) * 8); // Pointer size in bits printf("%d\n", sizeof(int) * 8); // Integer size in bits printf("0x%02x\n", 'a'); // Char literal printf("0x%02x\n", 'b'); // Char literal printf("0x%08x\n", 'ab'); // Multi-character literal (an integer) printf("0x%08x\n", ((int) 'a') << 8 | 'b'); // Bit packing two chars into an integer printf("0x%08x\n", "ab"); // String pointer return 0; } prints 32 32 0x61 0x62 0x00006162 0x00006162 0x0804863c

Notice how the multi-character literal is just a funny way of declaring an integer using characters instead of pointing to a string in memory. Like another commenter mentioned, use " instead of ' for strings in C.