r/cprogramming • u/Mediocre-Trainer-132 • Feb 26 '26
What's the best way to make a string variable?
I generally use:
char* string_variable = "text here";
But if there's a better way, let me know.
12
Upvotes
View all comments
Show parent comment
1
u/Swipsi Feb 28 '26
So the size of the char* returns the size of a char pointer, but the size of s[] would return the size of a char since thats what the first array element is pointed on by s[]?