How does this work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
9th Jun 2021, 5:29 AM
Vatsav
7 Answers
+ 2
Offset calculation 0 1 2 3 4 5 6 7 8 9 10 11 H e l l o w o r l d \0 Try to change 1 with another number, you'll understand how this works 👍 P.S. The '\0' is the null character used as string terminator in C-string a.k.a. char array.
9th Jun 2021, 6:50 AM
Ipang
+ 3
Vatsav substring works like this Take a string and initailize it with "Hello" If you write 1 it will print the while string except 1
9th Jun 2021, 9:00 AM
Atul [Inactive]
+ 2
I think so the one is doing the work of substring function
9th Jun 2021, 5:46 AM
Atul [Inactive]
+ 2
This is pointer arithmetic. 1 + pointer to a character (in your example, this pointer points to character 'H'. 1 means go to the next element.
10th Jun 2021, 10:04 PM
Lofty
Lofty - avatar
+ 1
Ok got it thanks for helping
9th Jun 2021, 6:53 AM
Vatsav
0
How does it actually work Atul
9th Jun 2021, 5:48 AM
Vatsav
9th Jun 2021, 5:49 AM
Vatsav