How declaration of variables behave?

后端 未结 2 812
萌比男神i
萌比男神i 2021-01-28 14:05
#include
#include

int main(){

    char i;
    int c;

    scanf(\"%i\",&c);
    scanf(\"%c\",&i);// catch the new line or charact         


        
2条回答
  •  独厮守ぢ
    2021-01-28 14:33

    The function expects a sequence of references as additional arguments, each one pointing to an object of the type specified by their corresponding %-tag within the format string, in the same order. Read about scanf

    These can additionally help you:

    I don't understand why I can't get three inputs in c

    scanf() leaves the new line char in buffer?

    Regarding the last portion of your question, the number of bits of int is always more than char, so it won't cause a problem.

提交回复
热议问题