Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions