Your question is very unclear, but it sounds to me that you do not want a one-dimensional array, but rather a two-dimensional array (despite your question explicitly stating the opposite).
I suggest that you change char *name[10]; to char name[10][10]; Also, you may want to change the variable name of the 2D-array name to names, because that name is misleading, as it implies that it contains only a single string.
Also, you must start the loop counter i at 0, not 1, as array indexes are zero-based in C.
After making these changes, your program should look like this:
#include <stdio.h>
int main( void )
{
char names[10][10];
int i = 0, input;
printf("How many days a week: ");
scanf("%d", &input);
do{
printf("Enter day %d: ", i+1);
scanf("%s", names[i]);
i++;
}while(i < input);
//output wanted
printf("The first day is: %s\n", names[0]);
printf("The fifth day is: %s\n", names[4]);
return 0;
}
This program has the following behavior:
How many days a week: 7
Enter day 1: Monday
Enter day 2: Tuesday
Enter day 3: Wednesday
Enter day 4: Thursday
Enter day 5: Friday
Enter day 6: Saturday
Enter day 7: Sunday
The first day is: Monday
The fifth day is: Friday
Note that the program will write to the array out of bounds if the user enters an integer larger than 10 or if any of the days has a length larger than 9 (10 including the terminating null character).
Also, your program would have a cleaner structure if you used a for loop instead of a while loop, as it reduces the scope of the loop counter.
Another issue is that the program will misbehave if the user does not enter a number. Instead, it should check if the function scanf succeeded, and to print an error message if it did not.
Therefore, it would be better to write it like this:
#include <stdio.h>
#include <stdlib.h>
#define MAX_DAYS 10
//MAX_DAY_LENGTH_FORMAT_STRING, which is used by scanf,
//should always be set to one less than MAX_DAY_LENGTH,
//because the latter also needs room for the terminating
//null character
#define MAX_DAY_LENGTH 10
#define MAX_DAY_LENGTH_FORMAT_STRING "%9s"
int main( void )
{
char names[MAX_DAYS][MAX_DAY_LENGTH];
int num_days;
//prompt user for input
printf( "How many days a week: " );
//attempt to read input
if ( scanf( "%d", &num_days ) != 1 )
{
printf( "Input error!\n" );
exit( EXIT_FAILURE );
}
//verify that input is in desired range
if ( ! ( 1 <= num_days && num_days <= 10 ) )
{
printf( "Input out of range!\n" );
exit( EXIT_FAILURE );
}
for ( int i = 0; i < num_days; i++ )
{
int num_read;
//prompt user for input
printf( "Enter day %d: ", i+1 );
//attempt to read input
if ( scanf( MAX_DAY_LENGTH_FORMAT_STRING "%n", names[i], &num_read ) != 1 )
{
printf( "input error!" );
exit( EXIT_FAILURE );
}
//check whether input was small enough to fit in buffer
if ( num_read == MAX_DAY_LENGTH && getchar() != '\n' )
{
printf( "Input too long to fit in buffer!\n" );
exit( EXIT_FAILURE );
}
}
//print input back to user
printf("The first day is: %s\n", names[0]);
printf("The fifth day is: %s\n", names[4]);
return EXIT_SUCCESS;
}
The program will now perform proper input validation instead of causing undefined behavior on bad input:
How many days a week: abc
Input error!
How many days a week: 11
Input out of range!
How many days a week: 7
Enter day 1: Monday
Enter day 2: Tuesday
Enter day 3: Wednesdaay
Input too long to fit in buffer!