Problem with array

Hi, I have implemented the function called " void split_sentences(void) ". Its output is array with 8 strings. I have the second function " void bubblesort(char sentences_sort[][100], int number_of_sentences) " that sort sentences alphabetically. They work fine. But I need to add the array from split_sentences as parameter to bubblesort() in the main function. Is it possible to do it somehow? Thank you!

1
2
3
4
5
6
7
8
9
10
void split_sentences(void){}

void bubblesort(char sentences_sort[][100], int number_of_sentences){}

int main(int argc, char *argv[])
{
    char sentences[][100]= ???;
   
    bubblesort(sentences, 8);
    }
Post the definition of split_sentences function.

Also, it is recommended to use std::vector instead of c-style arrays.
void split_sentences(void){
std::string text2 = text;
string unsorted[8];
stringstream string1(text);
string sentences;
while(getline(string1, sentences, '.')) {
//cout << sentences << "." << endl;
for (int i = 0; i < 1; i++){
unsorted[i] += sentences + ".";
}}
for (int j = 0; j < 8; j++){
cout << unsorted[j] << endl; }
}
@nebula190

The other topic:

http://www.cplusplus.com/forum/beginner/178075/


Just trying to point out some friendly ideas about posting etiquette. :+)

If you have more questions about the same code, just keep the original Topic going.

If no one replies, one can make another post into the existing Topic with "bump" or some other sentence and the Topic will appear at the top of the list again. Don't make a brand new Topic for this purpose.

Duplicate or multiple posts about the same subject are ultimately a time waster for those who reply.

So you could make a post here, directing people to reply to the other Topic and not this one, with a link to it.

Good Luck :+D

OK thanks:)
TheIdeasMan wrote:
So you could make a post here, directing people to reply to the other Topic and not this one, with a link to it.

Good Luck :+D
There's no need to mention it again. I noticed your remark. But I marked the former thread as solved and this new one is other code. I'll remember your message for the future.
Topic archived. No new replies allowed.