Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between different integer types

Tags:

c++

c

I was wondering what is the difference between uint32_t and uint32, and when I looked in the header files it had this:

types.h:      /** @brief 32-bit unsigned integer. */     typedef unsigned int uint32; stdint.h:      typedef unsigned   uint32_t; 

This only leads to more questions: What is the difference between

unsigned varName; 

and

unsigned int varName; 

?

I am using MinGW.

like image 798
user1507133 Avatar asked Aug 02 '12 21:08

user1507133


People also ask

How many types are in integer types?

The INTEGER data type stores whole numbers that range from -2,147,483,647 to 2,147,483,647 for 9 or 10 digits of precision. The number 2,147,483,648 is a reserved value and cannot be used. The INTEGER value is stored as a signed binary integer and is typically used to store counts, quantities, and so on.

What are the 4 different data types?

4 Types of Data: Nominal, Ordinal, Discrete, Continuous.


2 Answers

unsigned and unsigned int are synonymous, much like unsigned short [int] and unsigned long [int].

uint32_t is a type that's (optionally) defined by the C standard. uint32 is just a name you made up, although it happens to be defined as the same thing.

like image 86
Kerrek SB Avatar answered Sep 30 '22 09:09

Kerrek SB


There is no difference.

unsigned int = uint32 = uint32_t = unsigned in your case and unsigned int = unsigned always

like image 24
RiaD Avatar answered Sep 30 '22 08:09

RiaD