Why 'a' and "a" are not same in C? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why 'a' and "a" are not same in C?

Why in C - "a" is string and 'a' is character ? But if we type same in Python - "a" and 'a' both are strings, why?

25th Oct 2019, 8:34 AM
Ankit Verma
Ankit Verma - avatar
1 Answer
+ 5
Every programming language has their own datatypes and syntax rules. In Python, there is only one data type for text: str. So it's most convenient there to just allow all sorts of quotation marks. In the C's, a single letter and a chain of letters with a specified end (string) are two different things, so you need two different ways to write them.
25th Oct 2019, 10:08 AM
HonFu
HonFu - avatar