Introduction to 'C' Language:
C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972.
The language 'c' was derived from the 'B' language that was developed in AT&T Bell Laboratory by programmer Dennis Ritchie in the 1970s.
This 'C' Language was later used to rewrite the UNIX operating system.
'C' language has very strong features to write system programs.
Features Of 'C' Language:
(i) c is a simple portable and machine-independent High ALevel Language.
(ii) c language has a compiler to compile its source codes.
(iii) c has only 32 keywords and 52 operators. but has a large collection of rich standard library functions.
Example:- c keywords list :
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
(iv) 'c' is a case-sensitive language i.e., 'a' != 'A'
(v) Every statement in c must be ended with a semicolon(;).
(vi) every single c statement is called an elementary statement.
(vii) c compiler ignores white spaces (blank spaces).
Advantages of c languages:
(i) Easy to write
(ii) low cost
(iii)portable
(iv) Easy debugging
(v)speed of compilation
(vi) fast execution speed
Disadvantages of c languages:
(i) Lack of oop's concept
(ii) programming skills required to learn
(iii) not efficient as compared to python
(iv) concept of namespace
(v) Run-time checking
basic code in c languages:
#include<stdio.h>
int main(){
print("hello c");
return 0;
}
Compiler in c languages:
A compiler is a computer program that changes source code written in a high-level language into low-level machine languages.
Interpreter in c languages:
Translate the program one statement at a time.
Comment in c languages:
comments are hints that a programmer can add to make their code easier to read and understand.
Comments are of two types
(i) Single-line comments:
single line comment starts with two forward slashes (//)
Example:
//Ram is a boy.
(ii) multiple line comments:
multi line comments start with ( /*....*/ ).
Example:
/* Ram is a boy
I am a girl
he is a boy
you are a student*/.