Question: in C I need help with a while loop to re-run the program with new input unless the user request to exit the program. in
in C
I need help with a while loop to re-run the program with new input unless the user request to exit the program.
in this the helper function prints the user input in a specific way but that works fine for me I just need to do it again with new values without the program ending.
//helper function
int main()
{
char userInput[60];
printf("Please give me a sentence, or Exit(x): ");
scanf("%[^ ]s",&userInput);
char *x = "x";
char *X = "X";
if (userInput[0] == x[0] || userInput[0] == X[0]){
printf("Exiting!");
printf(" ");
return 0;
}
printf(" ");
helperfunction(userInput);
printf(" ");
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
