Table of Contents

Corning Community College

CSCS1320 C/C++ Programming

Project: DATA TYPE RANGES (dtr0)

Objective

To familiarize yourself with the available data types in C- the variations, the attributes, the ranges therein.

Prerequisites

In order to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved:

Scope

This project will be exploring the nature of some of the data types available to us in the C Programming Language. How much space is allocated to each type, and what are the ranges available for each type?

A program is provided that will display (to STDOUT) the size (in bytes), the lower and upper bounds of each studied type.

The data types covered for this project will include signed and unsigned variations of:

The sizeof() and printf() functions, as well as arithmetic and logical operators, will be utilized in performing much of the work.

Grabbing project resources

I have prepared a grabit for resources related to this project. To obtain:

lab46:~/src/cprog$ grabit cprog dtr0
make: Entering directory '/var/public/SEMESTER/cprog/dtr0'
'/var/public/SEMESTER/cprog/dtr0/Makefile' -> '/home/wedge/src/cprog/dtr0/Makefile'
'/var/public/SEMESTER/cprog/dtr0/dtr0.c' -> '/home/wedge/src/cprog/dtr0/dtr0.c'
make: Leaving directory '/var/public/SEMESTER/cprog/dtr0'
lab46:~/src/cprog$ 

At which point you can change into the newly created and populated dtr0 directory.

Please study the dtr0.c program, and look up or ask questions on aspects that you do not understand.

Compile it.

Execution

lab46:~/src/cprog/dtr0$ ./dtr0

Reflection

Be sure to provide any commentary on your journal regarding realizations had and discoveries made during your pursuit of this project. You should also consider adding extra comments into your program so that it can be a more valuable reference going forward.

Your task

You are to create a text file, called “dtr0.text” that you will submit for this project. It will contain your well-thought-out responses to the following questions:

Review of Compiling/Executing

Just to review the compilation/execution process for working with your source code, if we had a file, hello.c, that we wished to compile to a binary called hello, we'd first want to compile the code, as follows:

lab46:~/src/cprog/proj$ gcc -Wall --std=gnu99 -o hello hello.c
lab46:~/src/cprog/proj$ 

Assuming there are no syntax errors or warnings, and everything compiled correctly, you should just get your prompt back. In the event of problems, the compiler will be sure to tell you about them.

Conceptually, the arrangement is as follows:

gcc -Wall --std=gnu99 -o BINARY_FILE SOURCE_FILE

The BINARY_FILE comes immediately after the -o, NOT the SOURCE_FILE (it must never immediately follow a -o). It can precede, and such is perfectly valid (especially if you feel that way more intuitive).

The -Wall (treat all warnings as errors, increase general verbosity about warnings) and –std=gnu99 (switch compiler to use the C99 standard of the C language with GNU compiler extensions) are options given to the compiler.

To execute your binary, we need to specify a path to it, so we use ./, which references the current directory (the dot '.' tells the computer “my current location”, and the forward slash '/' is the directory separator):

lab46:~/src/cprog/proj$ ./hello
Hello, World!
lab46:~/src/cprog/proj$ 

Submission Criteria

To be successful in this project, the following criteria must be met:

Submit Tool Usage

Let's say you have completed work on the project, and are ready to submit, you would do the following:

lab46:~/src/cprog/dtr0$ submit cprog dtr0 dtr0.text
Submitting cprog project "dtr0":
    -> dtr0.text(OK) 

SUCCESSFULLY SUBMITTED
lab46:~/src/cprog/dtr0$ 

You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.

I'll be evaluating the project based on the following criteria:

13:dtr0:final tally of results (13/13)
*:dtr0:submitted file called dtr0.text [4/4]
*:dtr0:committed and pushed dtr0.c and dtr0.text to repo [4/4]
*:dtr0:sufficient info in dtr0.text [5/5]

Additionally: