I am trying to take input a string character by character. At the end of loop I am asking if the user want to continue entering into string. Code below is not producing desired output.
Please tell me the error.
#include<stdio.h>
#include<stdlib.h>
int main()
{
char str[100], ch= 'y';
int i=0;
while(ch =='y' )
{
printf("\nEnter a character ");
scanf("%c", &str[i]);
i++;
printf("\nDo you want to continue entering ");
scanf("%c", &ch);
}
return 1;
}