Saturday, 7 July 2018

Format specifier

Integer may be octal or in hexadecimal : %I
#include
int main()
{
    int a = 0;
    scanf("%i", &a); // input is 017 (octal of 15 )
    printf("%d\n", a);
    scanf("%i", &a); // input is 0xf (hexadecimal of 15 )
    printf("%d\n", a);
    return 0;
}














No comments:

Post a Comment