Hello...I need to write a program where i need to copy each word of a string into an array...
Eg(string s="hello how are you" arr[0]=hello,arr[1]=how....).
any help:?: ??
tlly
0
Newbie Poster
Recommended Answers
Jump to PostTry something like:
int main() { string name = "here is the code" ; char* tmp_name = (char*) malloc ( name.size() ) ; strcpy ( tmp_name,name.c_str() ) ; for (int i = 0; i < strlen (tmp_name); ++i ) { printf ( " \ncharacter %d is %c …
Jump to PostHello...I need to write a program where i need to copy each word of a string into an array...
Eg(string s="hello how are you" arr[0]=hello,arr[1]=how....).
any help:?: ??Thanks mate...but i need the solution in c++...is it posible??...sory for not specifying this at the start
In other words, "Thanks, but …
All 8 Replies
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
tlly
0
Newbie Poster
Infarction
503
Posting Virtuoso
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
andor
25
Posting Whiz in Training
iamthwee
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Grunt
commented:
Exactly :) [Grunt]
+2
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.