OiO.lk Blog C# The scanf function uses '%c' to accept input, but can perform string input
C#

The scanf function uses '%c' to accept input, but can perform string input


How to understand the running process of the following code.

void scan(void){
    char item;
    scanf("%c",&item);
    if(item == '#'){
        printf("\n");
        return;
    }
    printf("%c",item);
    scan();
}

Why can I input strings into the console, and scanf will not be executed again in the recursion, but each character will be read automatically instead?



You need to sign in to view this answers

Exit mobile version