---Advertisement---
Learn C

Learn C Language : Getting Started

By Smart Answer

Updated on:

---Advertisement---

C is a programming language developed at AT and T’s Bell Laboratories of USA in 1972.It was designed and written by a man named Dennis Ritchie.

Table of Contents

Where C Stands

[1] Problem oriented language or High level language:

These languages have been designed to give a better programming efficiency, i.e. faster program development.
Examples of languages falling in this category are FORTRAN, BASIC, PASCAL etc.

[2] Machine oriented languages or Low level languages:

These languages have been designed to give a better programming efficiency, i.e. faster program execution.
Examples of languages falling in this category are Assembly language and Machine language.

C Character Set

A character denotes any alphabet, digit or special symbol used to represent information.

Alphabets:

A, B, C,…..,Y, Z.
a, b, c,…..,y, z

Digits:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9.

Special Symbols:

*, {, }, (, ), _, #, % etc.

C Constants

The alphabets, numbers and special symbols when properly combined form constants, variables and keywords.
A constants is a quantity that doesn’t change.This quantity can be stored at a locations in the memory of the computer.

Types of C Constants:

Primary Constants:

Integer Constant
Real Constant
Character Constant

Secondary Constants:

Array
Pointer
Structure
Union
Enum

Rules for Constructing Integer Constants:

(1) An integer constant must have at least one digit.
(2) It must not have a decimal point.
(3) It could be either positive or negative.
(4) If no sign precedes an integer constant it is assumed to be positive.
(5) No commas or blanks are allowed within an integer constant.
(6) The allowable range for integer constant is -32768 to 32767.

Rules for Constructing Real Constants:

(1) A real constant must have at least one digit.
(2) It must have a decimal point.
(3) It could be either positive or negative.
(4) If no sign precedes an integer constant it is assumed to be positive.
(5) No commas or blanks are allowed within an integer constant.
(6) Range of real constant expressed in exponential form is -3.4e38 to 3.4e38.

Rules for Constructing Character Constants:

(1) A character constant is either a single alphabet, a single digit or a single special symbol enclosed within single inverted commas Both the inverted commas should point to the left.
(2) The maximum length of a character constant can be 1 character.

C Variables

A variable can be considered as a name given to the location in memory where this constant is stored.The content of the variable can change.

Types of C Variables:

In C, a quantity which may vary during program execution is called a variable.Variable names are names given to locations in the memory of computer where different constants are stored.These locations can contain integer, real, character constants.In any language, the types of variables that it can support depends on the types of constants that it can handle.This is because a constant stored in a location with a particular type of variable name can hold only that type of constant.
The rules for constructing different types of constants are different.However, for constructing variable name of all types the same set of rules apply.

Rules for constructing Variable Names:

(1) A variable name is any combination if 1 to 8 alphabets, digits or underscores.Some compilers allow variable names whose length could be upto 40 characters.Still, it would be safer to stick to the rule of 8 characters.
(2) The first character in the variable name must be an alphabet.
(3) No commas or blanks are allowed within a variable name.
(4) No special symbols other than an underscore (_) can be used in a variable name.

C 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.Some C compiler allow you to construct variable names which exactly resemble the keywords.However, it would be safer not to mix up the variable names and the keywords.the keywords are also called ‘Reserved words’.

C Comments

Comment about the program should be enclosed within /* … */

Multiline Comment

/* This Is….
…Multiline comment */

Singleline Comment

// This Is singleline comment.

Smart Answer

---Advertisement---

Related Post

Learn C Language : String

‹ previous What Is String The way a group of integer can be stored in an integer array, similarly a group of character can be stored in a ...

Learn C Language : Array

‹ previous Next › What are Arrays For understanding the arrays properly, consider the following program: main(){     int x;      x = 5;      x ...

Learn C Language : Data Type

‹ previous Next › Integer, long and short Sometimes, we know in advance that the value stored in a given integer variable will always be positive.When it is ...

Learn C Language : Functions

‹ previous Next › What is a Function A function is a self-contained block of statements that perform a coherent task of some kind.Every c program can be ...

Leave a Comment