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 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
Get step-by-step solutions from verified subject matter experts
