It's not bad practice to use nested if statements. Consider:
Code:
void foo( int *bar )
{
if( bar != NULL ) /* if it's NULL we can't use it, so we have to check that... */
{
if( *bar < 10 ) /* now that we know we CAN use it, do whatever... */
{
/* do stuff... */
}
}
}
That's just a simple example. If done cleanly, it's actually good practice.
As to your second question, it depends what "line" is defined as. Assuming you're just defining an array:
Code:
char line[ 10 ] = "Fantastic";
Then you must use at least 10 characters here, since you're treating it like a string. Remember strings all have an extra character on the end that you aren't seeing. So "Fantastic" is actually 10 characters, because it includes the null character ( \0 ).
Furthermore, array indexing starts out at zero, and continues through size-1. So you wouldn't have 0 - 8, you'd have 0 - 7 to work with, so even if you implicitly assigned the characters one at a time, and didn't treat it as a string, you'd still be too small at 8.
Quzah.