User Tools

Site Tools


notes:c4eng:fall2023:projects:dtr0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:c4eng:fall2023:projects:dtr0 [2023/09/13 12:34] – [DATA TYPES IN C] jparrishnotes:c4eng:fall2023:projects:dtr0 [2023/09/14 00:42] (current) – [DATA TYPES IN C] lbond1
Line 42: Line 42:
 **Unsigned int**- This type of data occupies 2 or 4 bytes of memory (16 or 32 bits) depending on the compiler and allows expressing a maximum of 65,536 at 2 bytes or 4,294,967,296 values at 4 bytes. Unsigned short int can contain only positive values along with zero. The range of values is from 0 to 65,535 at 2 bytes or 0 to 4,294,967,295 at 4 bytes. **Unsigned int**- This type of data occupies 2 or 4 bytes of memory (16 or 32 bits) depending on the compiler and allows expressing a maximum of 65,536 at 2 bytes or 4,294,967,296 values at 4 bytes. Unsigned short int can contain only positive values along with zero. The range of values is from 0 to 65,535 at 2 bytes or 0 to 4,294,967,295 at 4 bytes.
  
-**Signed long int**- This type of data occupies 4 or 8 bytes (32 or 64 bits) depending on the compiler and allows expressing a maximum of 4,294,967,295 at 4 bytes or 18,446,744,073,709,551,616 at 8 bytes. Signed long int can contain a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. +**Signed long int**- This type of data occupies 4 or 8 bytes (32 or 64 bits) depending on the compiler and allows expressing a maximum of 4,294,967,295 at 4 bytes or 18,446,744,073,709,551,616 at 8 bytes. Signed long int can contain a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
  
-**Unsigned long long int**- This type of data occupies 2,4 or 8 bytes of memory (16,32 or 64 bits) depending on the compiler and allows expressing a maximum of 65,536 at 2 bytes, 4,294,967,296 values at 4 bytes or 18,446,744,073,709,551,615 at 8 bytes. Unsigned long long int can contain a range of values from 0 to 18,446,744,073,709,551,615.+**Unsigned long int**- This type of data occupies 4 or 8 bytes (32 or 64 bits) depending on the compiler and allows expressing a maximum of 4,294,967,295 at 4 bytes or 18,446,744,073,709,551,616 at 8 bytes. Unsigned long int can contain a range of values from 0 to 18,446,744,073,709,551,615. 
  
 +**Signed long long int**- This type of data occupies 2,4 or 8 bytes of memory (16,32 or 64 bits) depending on the compiler and allows expressing a maximum of 65,536 at 2 bytes, 4,294,967,296 values at 4 bytes or 18,446,744,073,709,551,615 at 8 bytes. Signed long long int can contain a range of values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
 +
 +
 +**Unsigned long long int**- This type of data occupies 2,4 or 8 bytes of memory (16,32 or 64 bits) depending on the compiler and allows expressing a maximum of 65,536 at 2 bytes, 4,294,967,296 values at 4 bytes or 18,446,744,073,709,551,615 at 8 bytes. Unsigned long long int can contain a range of values from 0 to 18,446,744,073,709,551,615.
  
 +Due to the limitations of our Pi's and compiler, the max bit count should be 32, this will mean that un/signed long long and un/signed long types will share values
  
 ========COMPILE CODE========= ========COMPILE CODE=========
Line 74: Line 79:
  
 **%hu** - Specifies the output type as half of an unsigned int (4/2 =2 bytes) **%hu** - Specifies the output type as half of an unsigned int (4/2 =2 bytes)
 +
 +**%u**  - Specifies the output type as an unsigned int (4 bytes)
 +
 +**%d**  - Specifies the output type as a signed int (4 bytes)
  
 **%lld**- Specifies the output type as a signed long long int **%lld**- Specifies the output type as a signed long long int
Line 80: Line 89:
  
 **%p**- Specifies the output type as an address in hexadecimal digits   **%p**- Specifies the output type as an address in hexadecimal digits  
 +
 +Essentially, %u and %d are the bases for these, adding H before the u or d will half the byte count, and adding L's will increase the byte count. Within the project, each next data type increases in size. To represent this, you will change the specifier, mainly by increasing the byte count specified. 
 =====PROGRAM SPECIFICATIONS===== =====PROGRAM SPECIFICATIONS=====
  
notes/c4eng/fall2023/projects/dtr0.1694608478.txt.gz · Last modified: 2023/09/13 12:34 by jparrish