Question: Using C programming and UNIX/Linux terminal. ***************************************************************************************************** /* * lab7q1.c: Program to print the limits on the data types */ #include #include // defines symbols

Using C programming and UNIX/Linux terminal.

Using C programming and UNIX/Linux terminal. ***************************************************************************************************** /* * lab7q1.c: Program to

*****************************************************************************************************

/* * lab7q1.c: Program to print the limits on the data types */ #include #include // defines symbols such as CHAR_MAX, // which aremachine-dependent datatype // sizes int main() { /* In the following, sizeof() is used to obtain the size of a datatype. It returns a value of type size_t In printf() format specifications " " specifies a newline character "%20" says to use a field 20 character positions in width "%d" is used for signed decimal numbers "%u" is used for unsigned decimal numbers "%z" is a modifier that says that the argument is of type size_t "%h" is a modifier that says that the argument is of type short "%l" is a modifier that says that the argument is of type long N.B. the format specification of an argument and the type of the argument must correspond! */ printf(" Type Bytes Used MaxVal MinVal "); printf("--------------------------------------------------------------- "); printf("char: %zd bytes %20d %20d ", sizeof(char), CHAR_MAX, CHAR_MIN); printf("uns char: %zd bytes %20u ", sizeof(unsigned char), UCHAR_MAX); // min is 0 printf("short: %zd bytes %20hd %20hd ", sizeof(short), (short)SHRT_MAX, (short)SHRT_MIN); printf("uns short: %zd bytes %20hu ", sizeof(unsigned short), (unsigned short)USHRT_MAX); // min is 0 printf("int: %zd bytes %20d %20d ", sizeof(int), INT_MAX, INT_MIN); printf("uns int: %zd bytes %20u ", sizeof(unsigned int), UINT_MAX); // min is 0 printf("long: %zd bytes %20ld %20ld ", sizeof(long int), LONG_MAX, LONG_MIN); printf("uns long: %zd bytes %20lu ", sizeof(unsigned long int), ULONG_MAX ); // min is 0

return(0); }

Copy lab7q1.c to lab7q1_modified.c. Add to lab7q1 modified.ca single statement that will add to the table produced by the program the size of a variable that is of type unsigned long *. Make sure the additional output is the last line of the table. The output is to be two columns in width (the type and the size in bytes), and must line up with the existing columns of output produced by the program. Do not showa log of editing in your lab7.txt file. Perform a diff between lab7q1.c and lab7q1_modified.c

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To modify the lab7q1c file for your requirements follow these steps Step 1 Copy the Original File Co... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!