When I try parse string on nrf52832 with SEGGER Embedded Studio for ARM 4.16, I have a problem about "sscanf" :
Here is code:
static char num[10]; int main(void) { sscanf("12345", "%2s", num); NRF_LOG_INFO("Num: %s", num); sscanf("67890", "%2s", num); NRF_LOG_INFO("Num: %s", num); }
It should output:
Num: 12
Num: 67
But output is:
Num: 67
Num: 67
I try other compiler like https://www.onlinegdb.com/online_c_compiler, it output is i want : 12, 67.
But I don't know why is 67,67 on SEGGER Embedded Studio for ARM 4.16?
Is compiler problem or sscanf bug?