There are multiple ways to create a string in C:
char* string1 = "hi"; char string2[] = "world"; printf("%s %s", string1, string2)I have a lot of problems with this:
According to my understanding of [[Pointers]], string1 is a pointer and we're passing it to [[printf]] which expects actual values not references.
if we accept the fact that printf expects a pointer, than how does it handle string2 (not a pointer) just fine
I understand that char* is designed to point to the first character of a string which means it effectively points to the entire string, but what if I actually wanted to point to a single character
this doesn't work, because we are assigning a value to a pointer:
int* a; a = 8so why does this work:
char* str; str = "hi"[link] [comments]



![[iOS][Mac] Lifetime Pro IAP $10 → Free (48h) — RecordMark — voice notes with pins & transcription](https://external-preview.redd.it/YtBQSbs6xMBS__OIrr9eC4Ek71sFJIkh4c0So1yZWNc.png?width=640&crop=smart&auto=webp&s=0744d122255bc144037a76e5c4f087b72aa1cd1b)
![The Alabama Solution Trailer (2025) [1:57:00]](https://external-preview.redd.it/Djo00T_SWKRom0I3g_WiEUUbwfq9p7SdtGkTs_4kTak.jpeg?width=320&crop=smart&auto=webp&s=6cbbaea250ec8dd60e8a8db9f8e82ab1147b0172)


English (US) ·