Purchase Solution

Constant and Variable in a Program

Not what you're looking for?

Ask Custom Question

1. What is a data type in C? Describe two data types and how they might be used in a C program.

2. What is the difference between a constant and a variable in a program? Why would you use one or the other?

Purchase this Solution

Solution Summary

This solution discusses data types in C and the differences between constants and variables in a program.

Solution Preview

1. A C language programmer has to tell the system before-hand, the type of numbers or characters he is using in his program. These are data types. In C language, data types can be broadly classified as Primary data type, Derived data type and User-defined data type. Primary data type are fundamental data types, contains int, char, float, and double. int is used to define integer numbers. char defines characters. float is used to define floating point numbers. Double is used to define BIG floating point numbers and it reserves twice the storage for the number.
Derived data types defined by the system include pointer and array. User defined data types are built on existing types. These include typedef and enumerations.

Integer Type: Integers are whole numbers with a machine dependent range of values. A good programming language as to support the programmer by giving a control on a range of numbers and storage space. C has 3 classes of integer storage namely short int, int and long int. All of these data types have signed and unsigned forms. A short int requires half the space than normal integer ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Basic Networking Questions

This quiz consists of some basic networking questions.

Javscript Basics

Quiz on basics of javascript programming language.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.