-5

uint8 can be represented as ubyte, uint16 can be represented as is uword, uint32 can be represented as ulong, uint64 can be represented as ?

I am searching regarding how the unsigned integers can be represented as data type in c but I got confusion to how to present uint64 ?? Is it possible to use uint64 as udouble in c ?? please someone guide me ?? Will it support ??

what could be the format specifiers for all the above ??

I am simply adding this line because it is asking that the body does not meet the requirement and telling to add some content. So I added this.

2 Answers2

3

All these types uint8, uint16, uint32, uint64 are not standard fundamental types and they are either typedef names or implementation defined types

As for uint64 then it can be defined for example as

typedef unsigned long long uint64;

Take into account that sizes of integral types are implementation defined. So it could be that in the definition above it is enough to use unsigned long because on some platform sizeof( unsigned long) can be equal to 8 bytes.

If you want to use standard integral types that do not depend on used platform then you should include header <cstdint>

There are the following unsigned type definitions among other defined types

typedef unsigned integer type uint8_t; // optional
typedef unsigned integer type uint16_t; // optional
typedef unsigned integer type uint32_t; // optional
typedef unsigned integer type uint64_t; // optional

typedef unsigned integer type uint_fast8_t;
typedef unsigned integer type uint_fast16_t;
typedef unsigned integer type uint_fast32_t;
typedef unsigned integer type uint_fast64_t;

typedef unsigned integer type uint_least8_t;
typedef unsigned integer type uint_least16_t;
typedef unsigned integer type uint_least32_t;
typedef unsigned integer type uint_least64_t;
Vlad from Moscow
  • 224,104
  • 15
  • 141
  • 268
2
#include <stdint.h>

to get all types defined in global namespace.

#include <cstdint>

to get it defined in namespace std.

On my implementation i.e. in stdint.h I can find:

#if __WORDSIZE == 64
typedef unsigned long int   uint64_t;
#else
__extension__
typedef unsigned long long int  uint64_t;
#endif

and for uint32_t:

#ifndef __uint32_t_defined
typedef unsigned int        uint32_t;
# define __uint32_t_defined
#endif
4pie0
  • 27,469
  • 7
  • 70
  • 110