Type specifier %i, %d difference

Asked 1 years ago, Updated 1 years ago, 78 views

I know that you can use both the format specifiers %i and %d when printing integers.

What's the difference between you two? Did you make it separately?

format printf c++ c

2022-09-22 22:17

1 Answers

There is no difference between output such as printf.

However, when it is an input format specifier such as scanf,

That's the difference

int main(void) {
    int a;

    If scanf("%i", &a); //011 is entered, 9
    If scanf("%d", &a); //011 is entered, 11
}


2022-09-22 22:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.