Hey guys.
In C++, if I wanted to read strings into an array I would do this:
std::string theWord = "";
for ( int i = 0; i <= SIZE; i++ ) {
std::getline ( std::cin, stringArray[ i ] );
}
In C, I am having trouble comming up with a method that works
as simply.
I have come up with this:
nt i;
char data[ ARRAY_SIZE ] = { '\0' },
theWord[ 80 ];
puts("Enter ten strings:");
for ( i = 0; i < ARRAY_SIZE; i++ ) {
fgets( theWord, sizeof( theWord ), stdin );
data[ i ] += theWord;
}
But I am getting an error. I know using gets() is bad so I am trying to use fgets() like above. Am I on the right track?