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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started