Introduction to c language

c language

C is a general-purpose, structured programming language. It is reliable, easy to use that’s the reason it becomes one of the popular languages.

History of C language –

C is a programming language developed by AT &T’s Bell Laboratories of the United States of America in 1972. Dennis Ritchie designed and written c language.

C language is basically an outgrowth of two earlier programming languages BCPL and B. Bell Laboratories developed both the languages. After the launch, the American National Standard Institute(ANSI) published a standard definition of c language which included many new features.

c language

Characteristics of C language –

C is one of the most popular languages in the world. C has many characteristics and some of them are mentioned below –

  1. Simplicity – C has a rich collection of inbuilt functions, keywords and data types. Because c language uses a structured approach it is easy to learn.
  2. Portability – C language is a platform-independent language. A program written in one machine can be run in other machines.
  3. Quicker Compilation – C language is very fast and because of this reason, it is mostly used. It is faster than many languages.
  4. Memory Management – The various memory management functions are available in C which helps to save memory and increase efficiency.
  5. Used for System Programming – It contains bitwise operators and also can manipulate CPU registers, it can be used to develop operating systems.

Data Input & Output –

The three essential features of a program are entering the data, applying the logic to the program i.e processing the data and printing or displaying the data in a certain format.

Console I/O Function – Functions used to get input from the keyboard and write output to Monitor.

  1. Data Input Function – The function used to get the input value of any type form the keyboard is printf().  Using this, we can get the data into our program.
  2. Data Output Function – Using this function, we print the output from the program to the monitor or any displaying unit. Scanf() is used to print the output on the screen.

Structure of C Program –

In every programming language, there is a general procedure that is used to construct the program and is very important to understand.

1. Document Section This includes the comments to tell what program actually is. It is necessary to increase the readability of the program.
2. Link Section Which includes macros such as #define, #inlcude.
3. Global Declaration Section This basically includes global variables which are visible throughout the program,
4. Main Program Section From this part, the actual program starts.
5. Subprogram Section This contains the user-defined function.

Program for Understanding –

/*Program to print a string */
#inlcude<stdio.h> /* Link Secction*/
int a=10; /*Global Declaration*/
void main()
printf(“hey, Shouters! Welcome to Shout Coders”); /*Main Program */

Output – hey, Shouters! Welcome to Shout Coders.

Data Types in C language –

A variable in a program occupies some space in a computer’s memory where some value is stored. A value to be stored.

C supports different types of data which may be represented differently within a computer’s memory.

1. Basic or Primary Data Type – int, char, float and double are basic data types in c. Primary data types are augmented using data type quantifiers such as short, long, signed and unsigned.

  1. Character Data type – Char type is used to represent individual characters enclosed in single quotes. Example of Character type data is ‘C’, ‘1’, ‘a’. It uses the memory space of 1 byte. 1Byte =8 bits. The range of data type lies between -128 to 127.
  2. Integer Data type – This data type is used to store the data of numeric type. This data type is used for the manipulation of an integer data type. An example of the Integer data type is  1234, 654, 1. An integer data type uses a space of 4 Bytes. Its range lies between 0 to 65,535.
  3. Float Datatype – In this data type, data of decimal type with the capability of single precession is used. An example of the Float Data type is 3.11, 2.22. The size of the float data type is 4 Bytes,
  4. Double Data type – This data type is used to store floating-point numbers with double precession. An example of Double is 3.14000, 1.34666. The size of the variable is 8 bytes.

2. Derived Data Type – Derived data types are of 3 types and are Array, Function, and Pointer. These are changed according to the requirement of the programmer.

  1. Array – It is a homogeneous collection of the same data type. If you want to store data type of the same type, this is highly effective and improves the readability of the code.
  2. Function – Basically a function is made to do a specific task. If we want to use a program a number of times we make a function and call it according to requirement.
  3. Pointer – The pointer refers to the address of another data in the program and can access the value for its address.

Types of Operator in C language –

In any programming language, operators are used in the manipulation of the data stored. Operators are very helpful in solving mathematical problems.

Operator Category Operator
1. Unary Operator  -, ++, –, !
2. Arithmetic Operator  *, %, /, +, –
3. Relational Operator  <, <=, >=, >
4. Equality Operator  ==, !=
5. Logical AND  &&
6. Logical OR  ||
7. Conditional Operator  ?:
8. Assignment Operator  =, +=, -=, *=, /=, %=

This is basically the overview of C language. You can also read the recommended blogs for better understanding.


Difference between c and c++

Difference between java and c++

Leave a Reply

Your email address will not be published. Required fields are marked *

Close Bitnami banner