The address of str is fixed. Thus in statement
s[i]=str;
each element of the array of character pointers s gets the same address.
You coudl change the code snippet at least the following way
#include <string.h>
//...
#define N 6
//...
char s[N][10];
int n = N, i = 0;
char str[10];
while ( n-- )
{
scanf("%9s", str );
strcpy( s[i], str );
i++;
}
for( i = 0; i < N; i++ )
puts( s[i] );
The while loop would be better to write as a for loop
for ( i = 0; i < n; i++ )
{
scanf("%9s", str );
strcpy( s[i], str );
}
Also pay attention to that if your compiler supports Variable Length Arrays and the array s is a local variable of a function (for example of main) you could define it the following way
int n;
printf( "Enter the number of strings you are going to enter: " );
scanf( "%d", &n );
if ( n <= 0 ) n = N;
char s[n][10];
nis 0 at start of for loop. also all of your strings will point at the last one scanned..char *s[5];can hold five strings(char *).