i am having trouble with this c language code:
char st[2]; printf(\"enter first value:\"); scanf(\"%c\", &st[0]); printf(\"enter second value:\");
You're getting the implicit newline you entered as the second character, i.e. st[1] is getting the value '\n'. An easy way to fix this is to include the newline in the expected format string: scanf("%c\n", &st[0]);
st[1]
'\n'
scanf("%c\n", &st[0]);