Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

/* * 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

Students also viewed these Databases questions

Question

=+ To what extent does an evolutionary perspective on environmental

Answered: 1 week ago

Question

List the advantages and disadvantages of the pay programs. page 505

Answered: 1 week ago

Question

How will the members be held accountable?

Answered: 1 week ago

Question

a. Do team members trust each other?

Answered: 1 week ago

Question

a. How will the leader be selected?

Answered: 1 week ago