(i) char str = "hello"; (ii) char *str = "hello"; Why (i) is illegal and (ii) is legal? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

(i) char str = "hello"; (ii) char *str = "hello"; Why (i) is illegal and (ii) is legal?

24th May 2018, 12:14 PM
Rajkumar Tandel
Rajkumar Tandel - avatar
3 Answers
0
"---" is string literal and its type is pointer to char. So it's illegal.
24th May 2018, 12:16 PM
Disvolviĝo;
Disvolviĝo; - avatar
0
which is legal and which is illegal?
24th May 2018, 12:24 PM
Rajkumar Tandel
Rajkumar Tandel - avatar
- 3
first one's illegal cause it's char not chat
24th May 2018, 1:41 PM
‎ ‏‏‎Anonymous Guy