Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question
100%

 Write C++ code (perhaps around 20-30 lines of code) and make it compile and run showing how to use it. It can be a single code example, or multiple code examples to demonstrate the following.

a.       char

b.       short

c.       int

d.       sizeof

e.       typedef

f.        enum

g.       struct

h.       union

i.         pointer

Expert Solution
Check Mark
Step 1

Algorithm:

1. Declare a char variable c and assign it a value of 'A'.

2. Declare a short variable s and assign it a value of 123.

3. Declare an int variable i and assign it a value of 123456.

4. Print the size of each of the above variables in bytes.

5. Define a new type myInt as an alias for int.

6. Declare an enum Color and assign it a value of RED.

7. Declare a struct Point with two int variables x and y, and assign them values of 1 and 2 respectively.

8. Declare a union Data with an int and float variable, and assign the int variable a value of 42.

9. Declare an int variable j and assign it a value of 10.

10. Declare a pointer to int and assign it the address of j.

11. Print the value pointed to by the pointer.

12. End.

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education