scanf unworks when I use it twice or more

183 Views Asked by At

I'm new in C and mplab x and I have a hw need to do in this IDE. my printf works not as it should be so I want to knwo why and how can I change it.

setting:

mplab x IDE version:5.45

mplab xc32 compiler:4.00

pickit3

Uno32:PIC32MX320F128H

Windows 10

using Coolterm to input data

below is my testing code(not hw)

#include <stdio.h>
int main(void)
{
    char c[80];
    int i;    
    printf("name here:");
    scanf("%79s", c);
    printf("\nage here:");
    scanf("%d", &i);
    printf("\nname %s, age%d",c, i);
    return 0;
}

This is the result:

this is result

also what I did in coolterm was press "abcde" and "Enter" only.

0

There are 0 best solutions below