User Tools

Site Tools


notes:cprog: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:cprog:fall2023:projects:dtr0 [2023/09/12 22:00] – [REPRESENTATION: BASE 2 (BINARY)] jmerri10notes:cprog:fall2023:projects:dtr0 [2023/09/14 02:05] (current) – [BUILD THE CODE] xcroft
Line 2: Line 2:
  
 =====REPOSITORY STEPS===== =====REPOSITORY STEPS=====
 +Use the "hg add" command after you grab the project to add it to the repository.
  
 +Then use the "hg commit -m "(message here)"" command to let yourself know any changes you made before adding it to your repository.
 +
 +Then use the "hg push" command to finalize adding the file with the commit message.
 +
 +On a different system, you can use "hg pull" and "hg update" to update your changes on different systems, allowing you to save and load your work on lab 46 or on your personal system.
 =====BUILD THE CODE===== =====BUILD THE CODE=====
 +Can use https://learn.microsoft.com/en-us/cpp/c-language/cpp-integer-limits?view=msvc-170 to help you find the max and minimal for long/short signed/unsigned
  
 +Example 
 + value              = 0x7F;
 +    fprintf (stdout, "maximum value represented: %hhd\n", value);
 +    
 +    0x7F = 127 so the maximum value for a signed char would be 127
 =====RUN THE PROGRAM===== =====RUN THE PROGRAM=====
 You can do "make" to compile and if you get an error you can do "make debug" You can do "make" to compile and if you get an error you can do "make debug"
Line 13: Line 25:
 ====INTEGER VALUES==== ====INTEGER VALUES====
  
-====REPRESENTATION: BASE 2 (BINARY)==== +====REPRESENTATION: BASE 2 (BINARY)====  
-Recall there are 8 bits in 1 byte. +
 ====REPRESENTATION: BASE 16 (HEXADECIMAL)==== ====REPRESENTATION: BASE 16 (HEXADECIMAL)====
  
 ====STORAGE: BITS AND BYTES==== ====STORAGE: BITS AND BYTES====
 +The default byte size is 4, so hh (char) is half of half [(4/2)/2= 1 byte]; h (short int) is half (4/2= 2 bytes); just int alone is 4; l (long int) is double (4*2= 8 bytes); and ll (long long int) is also 8 bytes. 
  
 +Recall, there are 8 bits in 1 byte. After you know the size of the bytes, you can multiply that by 8 to find the number of bits (EX: byte size 4 has 32 bits).  
 ====BITWISE LOGIC: AND==== ====BITWISE LOGIC: AND====
 +to use AND logic, use the "&&" between two statements to say "this and this other thing"
 ====BITWISE LOGIC: OR==== ====BITWISE LOGIC: OR====
  
notes/cprog/fall2023/projects/dtr0.1694556031.txt.gz · Last modified: 2023/09/12 22:00 by jmerri10