Scrambling words in a string array?

closed account (yqD8vCM9)
I have 208 string in my array and I'm trying to shuffle them all.
When I run the program, it shuffle only every first letter of each string, not the whole string. Just the first letter. How can I get it to shuffle the whole string.
Last edited on
What you do is what you get.
closed account (yqD8vCM9)
Do you know what I did wrong?
Show me where do you shuffle the whole string.
closed account (yqD8vCM9)
Right here:
int m = rand() % 104;
int n = rand() % 2;

char t = dest[i][j];
dest[i][j] = dest[m][n];
dest[m][n] = t;
Last edited on
Where is there a string? Is for example t a string? Before speaking about strings you should at first understand what is the string.
closed account (yqD8vCM9)
I guess char t should be char t[]
And what about dest[i][j]? What is its type?
closed account (yqD8vCM9)
dest[i][j] is where the strings are contained. A c string.
Last edited on
No it is also only one character.
closed account (yqD8vCM9)
dest? I was unaware.
Topic archived. No new replies allowed.