How to create short unsigned type for 64 32 16 and 8 bits variables in C

1 Answer

0 votes
#include <stdio.h>

typedef unsigned long long U64;
typedef unsigned int       U32;
typedef unsigned short     U16;
typedef unsigned char      U8;


int main() {

    U64 n_64 = 38465287346734;
    U32 n_32 = 4194967295;
    U32 n_16 = 5846529;
    U32 n_8 =  285;

    printf("%I64d\n", n_64); // gcc
    printf("%u\n",    n_32);
    printf("%u\n",    n_16);
    printf("%u\n",    n_8);

    return 0;
}




/*
run:

38465287346734
4194967295
5846529
285

*/

 



answered Apr 13, 2022 by avibootz

Related questions

...