0
Why my 2nd char input line in do_while loop getting skipped?
Can anyone help? My 2nd char input line in do_while loop getting skipped . . . here's the code: #include <stdio.h> main() { char C,A; printf("\n ASCII Converter\n"); do { printf("\n Enter the Char: "); C=getchar(); printf(" ASCII CODE/VALUE: %d\n",C); printf("Again? y/n\n\n"); scanf("%c",A); }while (A=='y' || A=='Y'); if(A=='y' || A=='Y') return 0; }
8 Answers
+ 2
scanf needs a reference.
scanf("%c", &A);
+ 2
Try entering "cyan" (without the quotes) when submitting inputs.
+ 1
Could you please put the code on Code Playground and put the link in this thread? It would be much easier to debug.
+ 1
There is nothing wrong with this code. What's the problem?
scanf doesn't print anything if this is what you have in mind.
0
updated:
#include <stdio.h>
main()
{
char C,A;
printf("\n ASCII Converter\n");
do
{
printf("\n Enter the Char: ");
scanf("%c",&C);
printf(" ASCII CODE/VALUE: %d\n",C);
printf("Again? y/n\n\n");
scanf("%c",&A);
}while (A=='y' || A=='Y');
if(A=='y' || A=='Y')
return 0;
}
still not working :/
0
the #12 line, where it should've taken an char input y or something else then repeat the loop, it doesn't. No matter what, I cant make the loop repeat.
0
getting somewhere now... ayby shows the value of a then y repeats the loop shows the value of b then y repeats the loop.