strcat (string3, &string2[start-of-second-half]); This passes the address of the position of string2 you want to add.
WaltP
Posting Sage w/ dash of thyme
11,404 posts since May 2006
Reputation Points: 3,421
Solved Threads: 1,055
Skill Endorsements: 37
Is the second half of string2 preceded by a space?
zeroliken
Nearly a Posting Virtuoso
1,346 posts since Nov 2011
Reputation Points: 214
Solved Threads: 205
Skill Endorsements: 14
Do you just need to copy 1 word or is it a sentence that you need to copy the whole second half of the sentence?
well you could do it like this
use strtok for the string 2 and set space as the delimeter
once it's at its second iteration then you could copy the content to string3
zeroliken
Nearly a Posting Virtuoso
1,346 posts since Nov 2011
Reputation Points: 214
Solved Threads: 205
Skill Endorsements: 14
why you use strcat() method....you can try use loop read char by char and place in third string
mani-hellboy
Junior Poster in Training
69 posts since Feb 2012
Reputation Points: 0
Solved Threads: 7
Skill Endorsements: 0
why you use strcat() method....you can try use loop read char by char and place in third string
My guess is that the purpose of the function is to concatinate strings, which is also (surprisingly) the object of the assignment.
What do you put if the position of the beginning of the second half is unknown, since this is from user input?
If you don't know where "the position of the beginning of the second half is, you can't do the program. I assume you need to figure out where the second half starts.
WaltP
Posting Sage w/ dash of thyme
11,404 posts since May 2006
Reputation Points: 3,421
Solved Threads: 1,055
Skill Endorsements: 37
Given: sentence 1 = "This it the time to fly"
Given: sentence 2 = ""To err is human, to really foul things up takes a computer"
What is the resulting sentence supposed to be? Not by computer. By definition of the assignment.
WaltP
Posting Sage w/ dash of thyme
11,404 posts since May 2006
Reputation Points: 3,421
Solved Threads: 1,055
Skill Endorsements: 37
First half of string 1 would be: This is the
Second half of string 2 would be: ul things up takes a computer
It would display as: "This it the ul things up takes a computer"
How do you figure this?
What did you do to arrive at "This is the" and "ul things up takes a computer"?
Put that into code...
How long is a sentence? How can you figure that out in code?
What's half a sentence?
etc, etc...
'Tis simplicity itself when you stop thinking in terms of the end product, and think in terms of one step at a time.
Remember, a journey of a thousand miles begins with a single step. Then another. And another. Until you drop 10 feet before the gate in exhaustion. No wait -- that's not how it goes. :icon_wink:
WaltP
Posting Sage w/ dash of thyme
11,404 posts since May 2006
Reputation Points: 3,421
Solved Threads: 1,055
Skill Endorsements: 37