can we also use strtok(), when we need to separate a string of type:
MyNameIsAdarshSingh
about each capital letter and get output as:
My
Name
Is
Adarsh
Singh
can we also use strtok(), when we need to separate a string of type:
MyNameIsAdarshSingh
about each capital letter and get output as:
My
Name
Is
Adarsh
Singh
hi @adarshsingh2k strtok() function takes a string of delimiters, so if you want to separate a camel case string, you can put all the uppercase letters as delimiters. Please note that you will get inaccurate answer with this because output will be
y
ame
s
darsh
ingh
I hope you understood the logic behind this output.
why my code is not working and showing an error
@adarshsingh2k string s[n] is actually used to make an array of strings. Also, strtok() function only works on char* datatype (character array). Here is your corrected code https://ide.codingblocks.com/s/262111