In C programming, Strings and Characters are fundamental for handling text-based data. But did you know thereβs a major difference between 'A' and "A" in C?
β
'A' is a Character β Stored as a single byte in memory.
β
"A" is a String β Stored as two bytes (A + \0).
π‘ Memory Representation:
'A' β Stored as ASCII value 65
"A" β Stored as 65 + 0 (null character)
Quick Tip π‘
π Always use single quotes for characters ('A').
π Use double quotes for strings ("Hello").
π C strings always end with a null character (\0).
π₯ Bonus: Want to master Strings in C? Check out my detailed blog where I covered:
β
String functions like strlen(), strcpy().
β
Pointer to String (the most powerful technique).
β
Detailed memory representation for both.
π Read my full blog here: Strings and Character in C
Top comments (0)