Question: Question 4. Complete the conditional while loop that continues to prompt the user with a question Do you wish to continue? until the user enters

 Question 4. Complete the conditional while loop that continues to prompt

Question 4. Complete the conditional while loop that continues to prompt the user with a question "Do you wish to continue?" until the user enters a character other than ' y ' (lower-case y). Every time the user enters ' y ', memory for ptr is increased to accommodate an additional integer. The value assigned to this newly allocated memory is (current iteration number of the loop - 1) * 2. For example, in iteration 1 , space for 1 integer is allocated and the value assigned is 0 , in iteration 2 , memory for ptr is increased to accommodate an additional integer and the value assigned is 2 , and so on. Hint: Use malloc() and realloc() int * ptr = NULL; int i; char ans =; i= =0; while (ans = ' y){ Il your code goes here printf ("Do you want to continue? "); scanf ("sc", Sans); geteharl)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!