C constants can be divided into two major categories:
a> Primary Constants
b> Secondary Constants
C constants
_______________________|_____________________
| |
Primary Constants Secondary Constants
| |
1) Integer Constant 1) Array
2) Real constants 2) Pointer
3) Character constants 3) Structure
4) Union
5) Enum. Etc
At this stage, We could restrict our Discussion to only Primary Constants, namely, Integer, Real and Character constants.
For constructing these different types of constants,Certain rules have been laid down.
RULES FOR CONSTRUCTING INTEGER CONSTANTS.
A> An integer constants must have at least one digit.
B> It must not have a decimal point.
C> It can be either positive or negative.
D> If no sign precedes an integer constants, it is assumed to be positive.
E> No commas or blanks are allowed within an integer constants.
F> The allowable range for integer constants is-2147483648 to +2147483647.
The range of an integer constants depends upon the compiler.For example like Visual Studio, gcc, it is -2147483648 to+214748364, whereas for compilers like turbo c or turbo c++ the range is -32768 to +32767.
ex.
426
782
-8000
-7605
Blog Archive
Friday, February 17, 2012
Thursday, February 16, 2012
Constants, Variables and Keywords
The alphabets, numbers and special symbols when properly combined from constants variables and keywords. Let us see what are 'constants' and 'variables' in C. A constant is an entity that
doesn't change, whereas, a variable in an entity that may change.
In any program we typically do lots of calculations. The results of these calculation are stored in computer's memory. Like human memory, the computer's also consist of millions cells. to make the retrieval and usage of these values easy these memory cells are given names. Since the values stored in each location may change the names.
consider an example:-
Here 3 is stored in a memory location and a name x is given to it. Then we have assigned a new value 5 to the same memory location x. This would overwrite the earlier value 3, since a memory location can hold only one value at a time
doesn't change, whereas, a variable in an entity that may change.
In any program we typically do lots of calculations. The results of these calculation are stored in computer's memory. Like human memory, the computer's also consist of millions cells. to make the retrieval and usage of these values easy these memory cells are given names. Since the values stored in each location may change the names.
consider an example:-
Here 3 is stored in a memory location and a name x is given to it. Then we have assigned a new value 5 to the same memory location x. This would overwrite the earlier value 3, since a memory location can hold only one value at a time
The C character set
A character denotes any alphabet, digit or special symbol used to represent information.
1> alphabets A,B,........Y,Z a,b,............,y,z
2> digits 0,1,2,3,4,5,6,7,8,9
3> special symbols ~`!@#$%^&*()_-+=|\{}[]:;"'<>,.?/
1> alphabets A,B,........Y,Z a,b,............,y,z
2> digits 0,1,2,3,4,5,6,7,8,9
3> special symbols ~`!@#$%^&*()_-+=|\{}[]:;"'<>,.?/
Wednesday, February 15, 2012
What is c ?
1) C is a programming language developed by at AT & T's Bell Laboratories of USA in 1972.
It was designed and written by a named Dennis Ritchie.In the late seventies C began to replace the more familiar languages of that time like PL/I, ALGOL, etc. No one pushed C. It wasn't made the official Bell Labs language. thus, without any advertisement, C' reputation spread and its pool of users grew. Ritchie seems to have been rather surprised that so many programmers preferred C to older languages like FORTON or PL/I, or the newer ones like Pascal and APL. But, that's what happened.
a)Me thinks that nobody can learn C++, C# or java directly. This is because while learning these languages you have thing like classes, objects, inheritance, polymorphism, templates, exception handling, references, etc.
b)Major parts of popular OS likes Windows, UNIX, Linux are still written in C.
c)Mobile devices like cellular phones and palmtops have become rage of today :)
Subscribe to:
Posts (Atom)