Ah, got it
Using scanf is tricker in this case.
There are several ways to go, depends what you know already.
Pick one of these which makes most sense. Replace your scanf call with one of these code fragments.
Code:
for ( j = 0 ; j < 15-1 ; j++ ) {
name[i][j] = getchar();
if ( name[i][j] == '\n' ) {
name[i][j] = '\0';
break;
} else {
name[i][j+1] = '\0';
}
}
Code:
fgets( name[i], 15, stdin );
name[ strlen(name[i]) - 1 ] = '\0'; /* remove the newline */
Code:
scanf( "%[^\n]", name[i] ); /* read all chars upto the \n */
getchar( ); /* remove the \n */