Unit 2 Assignment 1
Chapter 10, Exercises 10.5 & 10.8
In your textbook, C How to Program, please complete the following:
• Chapter 10: C Structures, Unions, Bit Manipulations, and Enumerations
o Exercises 10.5, 10.8 on pgs 413 & 414
Please read all instructions carefully.
Since part of this exercise requires you to create a program, you must:
• Format and add comments appropriately
• Submit your error free .c source file
• Create and submit a flowchart that matches your program file
10.5 Provide the definition for each of the following structures and unions:
a) Structure inventory containing character array partName[ 30 ], integer partNumber, floating point price, integer stock and integer reorder.
b) Union data containing char c, short s, long b, float f and double d.
c) A structure called address that contains character arrays streetAddress[ 25 ], city[ 20 ], state[ 3 ] and zipCode[ 6 ].
d) Structure student that contains arrays firstName[ 15 ] and lastName[ 15 ] and variable homeAddress of type struct address from part ( c).
e) Structure test containing 16 bit fields with widths of 1 bit. The names of the bit fields are the letters a to p.
10.8 (Using Unions):
Create union integer with members char c, short s, int i and long b. Write a program that inputs value of type char, short, int and long and stores the values in union variables of type union integer. Each union variable should be printed as a char, a short, an int and a long. Do the values always print correctly?
Excellent Solution
================
*Instant Download
Unit 2 Assignment 1 Chapter 10, Exercises 10.5 & 10.8
- Technology: C-Programming
- Code: SHC_C_100012
-
$9.99
Tags: c, programming, Structure, inventory, character, array, union