December 11th, 2012, 01:09 PM
Join Date: Dec 2012
Time spent in forums: 46 m 56 sec
Reputation Power: 0
Originally Posted by salem
> //Output is world. It's supposed to be but it's printing worldi for some reason.
Where are these lines?
If you don't end your strings properly with a \0, you're likely to print garbage.
What kind of dynamic array do you want?
char words; // fixed length words, fixed number of words
char *words; // variable length words, fixed number of words
char (*words); // fixed length words, variable number of words
char **words; // variable length words, variable number of words
I see. I really want variable length words and number of words because it's based on whatever the user gives.
Am I supposed to use *(*(words+j)+k) when I'm adding a letter to a word and *(words+j) when I'm trying to print the word? Or since it's a pointer to a pointer of chars I need to iterate to print the whole word?