Having a little trouble with this simple program. I can solve this by making response[10] a global variable but I don't want to do that. Program tests for a proper response and works but the return string is garbage:
#include <stdio.h>
#include <string.h>
char *user_string(char *Setting_Type[]);
int main()
{
char *response;
char *test_names[2] = {"Test", "test"};
printf("Enter \"Test\" or \"test\": ");
response = user_string(test_names);
printf("\nCorrect! Your input is: %s\n", response);
return 0;
}
char *user_string(char *Setting_Type[])
{
int loop = 1;
char response[10];
char *response_string;
while(loop = 1)
    {
    scanf("%s", &response);
    response_string = response;
    if(strcmp(response_string, Setting_Type[0]) != 0 && strcmp(response_string, Setting_Type[1]) != 0)
        printf("\nWrong! Please try again: ");
    else
        break;
    }
return response_string;
}
 
     
     
     
    