Title | Lab 3 - Byte Ordering - Lab assignment instructions |
---|---|
Author | AN Y |
Course | Systems Software |
Institution | Lehigh University |
Pages | 1 |
File Size | 76.9 KB |
File Type | |
Total Downloads | 36 |
Total Views | 148 |
Lab assignment instructions...
Lab 3 - Byte Ordering The objectives of this lab are as follows. ● Understand how multi-byte objects are stored in memory ● Understand and be able to use the ternary operator (?:) ● Understand and be able to use the uintX_t family of data types (and their cousins, intX_t) ● Understand how unsigned loop variables can introduce functional bugs ● Understand how the bit left-shift operator and bitwise-AND operator can be used to mask a byte and reveal the value of a bit In this lab, you will be implementing four functions, all of which are intended to print out the bytes of characters one bit at a time. There is no direct way to do this in C. That’s why you are going to do it! a) print1byte () b) print2bytes() c) print4bytes() d) print8bytes() Please read and follow these directions. 1) Login to a sunlab computer and make a directory in which to work on lab3 & change to that directory. 2) Copy the lab3.c source code file and lab3_ref executable from the following directory ~merle/cse109.fall2021/lab3 3) Run lab3_ref to see the output you will work to create in your lab3.c file. Examine the output closely… as you are expected to learn/solidify your understanding of byte ordering! 4) View/edit lab3.c to see the prototypes, the main function, and the function shells. Hey, top down programming! As stated earlier, you will be implementing four functions. You will also answer a few questions along the way by placing your responses at the bottom of your lab3.c file. 5) Make changes to lab3.c based on the comments in the file. Answer questions as prompted. 6) Compile lab3.c as follows. gcc -g -Wall -Wextra -Wwrite-strings -o lab3 lab3.c OR mg -o lab3 lab3.c You should not get any warnings. It is expected the code you submit will not yield any errors or warnings when compiled. 7) Run “lab3” (with or without arguments) and observe the output. When it matches the output of lab3_ref, you are done! 8) Submit your lab3.c to Coursesite....