Hello! Help solve the problem : Enter a string, cut out 3 letters (for example : book -> k ) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hello! Help solve the problem : Enter a string, cut out 3 letters (for example : book -> k )

https://code.sololearn.com/cByP6R9ci5Ki/?ref=app

17th Nov 2020, 10:48 AM
Plutos
Plutos - avatar
4 Answers
+ 5
Do you always want the first three letters to be cut out? In that case, you could print str + 3 to get the desired output, which is basically printing the string starting at the fourth character. However, it might be a good idea to check if the string is actually longer than three characters, otherwise accessing the string outside of its bounds could lead to some unexpected outcome. Or just null-initialize the string, in which case checking the string length becomes redundant, i.e. char str[ 10 ] = {};
17th Nov 2020, 11:03 AM
Shadow
Shadow - avatar
0
I'm sorry, but I don't understand.Can you show me?
17th Nov 2020, 11:37 AM
Plutos
Plutos - avatar
0
Thank you
17th Nov 2020, 12:04 PM
Plutos
Plutos - avatar
0
Give the best answer to shadow, giving a good details.
17th Nov 2020, 12:16 PM
你知道規則,我也是
你知道規則,我也是 - avatar