I have a string,
char* str = "HELLO"
If I wanted to get just the E from that how would I do that?
E
char* str = "HELLO"; char c = str[1];
Keep in mind that arrays and strings in C begin indexing at 0 rather than 1, so "H" is str[0], "E" is str[1], the first "L" is str[2] and so on.
str[0]
str[1]
str[2]
2.1m questions
2.1m answers
60 comments
57.0k users