Problems with character input using scanf()

后端 未结 4 709
暖寄归人
暖寄归人 2020-11-27 22:24

I\'m trying to input a character into a linked list, where the character can be \'A\',\'a\',\'G\',\'g\',\'T\',\'t\',\'C\' or \'c\'.

I\'m not yet familiar with C and

4条回答
  •  爱一瞬间的悲伤
    2020-11-27 22:52

    add space to "%c" to catch the newline character. the space charcter is used to catch space characters, tabulations, newline

    scanf("%c ",&newChar);
    

提交回复
热议问题