Last active
June 26, 2019 17:16
-
-
Save jstaursky/0a3439eda41c62f6b5508d646a8496b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> // for fixed width types e.g. uint8_t, etc. | |
#include <inttypes.h> // for PRI{fmt}{type} and SCN{fmt}{type} macros | |
int main() | |
{ | |
uint32_t num; | |
scanf("%"SCNu32, &num); | |
printf ("%"PRIu32"\n", num); | |
return 0; | |
} | |
/* * PRINTF * */ | |
// Fixed Width types need to use PRI{fmt}{type} macro for use with printf | |
// where fmt is | |
// (d)ecimal, (x)hex, (o)ctal , (u)nsigned, (i)nteger. | |
// and type is | |
// N, FASTN, LEASTN, PTR, MAX | |
// where N corresponds to the number of bits in the arg (N=8,16,32,64). | |
/* * SCANF * */ | |
// Fixed Width types need to use SCN{fmt}{type} macro for use with scanf. | |
// more info found here https://en.wikipedia.org/wiki/C_data_types#inttypes.h |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment