Posts

Showing posts from April 19, 2018

Type of C constants

Image
C constants can be divided into two major categories :      (a)    Primary Constants      (b)    Secondary Constants these constant are further are categorized as shown in in figure. At this stage, we would restrict our discussion to only primary constants, namely, Integer, Real and Character constants. Let us see the details of each of these constants. For constructing these different types of constants, certain rules have been laid down. These rules are as under.   Rules for Constructing Integer Constants   (a) An integer constant must have at least one digit.   (b) It must not have a decimal point.   (c) It can be either positive or negative.   (d) If on sign precedes an integer constant, it is assumed to be positive.   (e) No commas or blanks are allowed within an integer constant.   (f) The allowable range for integer constant is -2147483648 to +2147483647. Ex :-  482   ...

Constants, Variables and Keywords

Image
the alphabets, numbers and special symbols when properly combined form constants, variables and keywords. Let us see what are 'constants' and 'variables' in C.   A constants is an entity that does not change, whereas, a variable is an entity that may change. In any program we typically do lots of calculations. the result of these calculations are stored in computer's memory. Like human memory, the computer memory also consists of millions of cells. the calculate values are stored in the memory cells. To make the retrieval and used of this values easy these memory cells (also called memory location) are given name. Since the value stored in each location may change the names given to these locations are called variable names. Consider the example shown in bellow.    Here 4 is stored in a memory location and a name X is given to it. then we have assigned a new value 7 to the same memory location X. This would overwrite the earlier value 4, since a memory locatio...