Components of C language



There are five main component of C language :-
1. The character set: Any alphabet ,digit or special symbol ,used to represent information is denoted by character. The character in C are grouped into four categories:-
i) Letters A...Z and a...z
ii) Digits 0,1,2,.....9
iii) Special Symbol ~ ` ! @ # $ % ^ & * () . < > ? / " : ; { }[ ].
iv) White Space,blank space, Carriage return, form feed, newline, horizontal tab.
C uses the uppercase letter A to Z, the lowercase letters a to z, the digits 0 to 9, and certain special characters as building blocks to form basic program elements ( e.g., constants, variables, operators, expressions, etc.
Some of the special characters are listed below:
+ - * ~ % / & ( ) { } [ ] ? " < > ! ; :
Most versions of the language also allow certain other characters, such as @ and $, to be included within strings and comments.
C uses certain combinations of these characters, such as \b,\n and \t, to represent special conditions such as backspace, new line, and horizontal tab, respectively
These character combinations are known as escape sequences.


2. The data types: The power of the programming language depends, among other thing, on the range of different types of data it can handle. We can use several basic types of data values such as character, integer, float, double.


3. Constants: A constant is a fix value that doesn't change while program execution.There are basically 2 types of constants
i) Primary constants:- Integer constants, Real constants, Character constaints.
ii) Secondary constants:- Array, Structure, Union, Pointer, etc.
Character constants are enclosed between single quotes. e.g. 'a' & '%' etc.


4. Variable: A variable is an entity whose value can change during program execution.Variable names are names given to locations in memory. These locations can contain integer, real or character constants.

Rules for Constructing Variable Names
i) A variable name is any combination of 1 to 31 alphabets, digits or underscores. Some compilers allow variable names whose length could be up to 247 characters. Do not create unnecessarily long variable names.
ii) The first character in the variable name must be an alphabet or underscore.
iii) No commas or blanks are allowed within a variable name.
iv) No special symbol other than an underscore can be used in a variable name.

5. Keywords: Keywords are the words whose meaning has already been explained to the C compiler.The keywords cannot be used as variable names because if we do so we are trying to assign a new meaning to the keyword, which is not allowed by the computer.The keywords are also called reserved words. There are 32 keywords.
auto, double, int, struct, break, else, long, switch, case, enum, register, typedef, char, extern, return, union, const, float, short, unsigned, continue, for, signed, void, default, goto, sizeof, volatile, do, if, static, while,

Comments

  1. Preprocessor Commands : The preprocessor in C step comes before compilation of c program and it instruct the compiler to do required pre-processing before actual compilation.

    ReplyDelete

Post a Comment

Popular posts from this blog

Decision making using if statement

How to make payment for final certificate, migration, provisional for the students of last semester of ptu?