0% found this document useful (0 votes)
20 views6 pages

C & Its Structure-1

C is a general-purpose, procedural programming language developed by Dennis M. Ritchie in 1972, primarily for system programming and the UNIX operating system. It is known for its simplicity, efficiency, and flexibility, serving as the foundation for many modern programming languages. The structure of a C program includes sections such as documentation, preprocessor directives, definitions, global declarations, the main function, and user-defined functions.

Uploaded by

devbhardwaj1256
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views6 pages

C & Its Structure-1

C is a general-purpose, procedural programming language developed by Dennis M. Ritchie in 1972, primarily for system programming and the UNIX operating system. It is known for its simplicity, efficiency, and flexibility, serving as the foundation for many modern programming languages. The structure of a C program includes sections such as documentation, preprocessor directives, definitions, global declarations, the main function, and user-defined functions.

Uploaded by

devbhardwaj1256
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Unit – 1

• C is a general-purpose, procedural, high-level programming language


used in the development of computer software and applications,
system programming, games, and more.
1. C language was developed by Dennis M. Ritchie at the Bell Telephone
Laboratories in 1972.
2. It is a powerful and flexible language which was first developed for the
programming of the UNIX operating System.
3. C is one of the most widely used programming languages.
• C programming language is known for its simplicity and efficiency.
• C programming is considered as the base for other programming languages, that is
why it is known as mother language.
• Purpose: Originally designed for system programming, especially for writing the
UNIX operating system.

It can be defined by the following ways:


I. Mother language
II. System programming language
III. Procedure-oriented programming language
IV. Structured programming language
V. Mid-level programming language

History of C

The C language was developed by Dennis Ritchie at Bell Laboratories in 1972. It was
designed to overcome the limitations of an earlier language called B, which was used
primarily for system programming. B itself was derived from another language called BCPL.

C was created to provide a more powerful and versatile programming tool, especially for
writing operating systems and low-level software. Its design aimed to be efficient and close
to the hardware, while also being flexible and portable across different computer systems.

Let's see the programming languages that were developed before C language.
Language Year Developed By

Algol 1960 International Group

BCPL 1967 Martin Richard

B 1970 Ken Thompson

Traditional C 1972 Dennis Ritchie

K&RC 1978 Kernighan & Dennis Ritchie

ANSI C 1989 ANSI Committee

ANSI/ISO C 1990 ISO Committee

C99 1999 Standardization Committee

Importance and Features of C

1. Foundation for Other Languages: C is the basis for many modern programming languages,
including C++, C#, and Objective-C. Understanding C provides a solid foundation for learning
these languages.

2. System Programming: C is widely used for system programming, including developing


operating systems (e.g., UNIX) and system utilities. Its low-level access to memory and
hardware makes it ideal for such tasks.

3. Efficiency and Performance: C provides fine control over system resources and memory
management, leading to highly efficient and performant code. This efficiency is crucial in
environments with limited resources, such as embedded systems.

4. Portability: Programs written in C can be compiled and run on different types of computer
systems with minimal changes. This cross-platform capability is one of C's key strengths.

5. Widespread Use: Due to its efficiency and versatility, C is used in various domains,
including embedded systems, game development, and high-performance computing.
Features of C Language

1. Simplicity: C has a simple and straightforward syntax that is easy to learn and use. This
simplicity helps programmers understand and write efficient code.

2. Low-Level Access: C provides low-level access to memory through pointers, allowing for
direct manipulation of hardware and memory addresses. This feature is essential for system
programming.

3. Structured Programming: C supports structured programming, which emphasizes


breaking down a program into smaller, manageable functions. This approach promotes
modularity and reusability of code.

4. Rich Library Support: C comes with a standard library that provides a wide range of
functions for performing common tasks, such as input/output operations, string handling,
and mathematical computations.

5. Portability: Code written in C can be compiled and executed on various hardware


platforms and operating systems with minimal modification, making it highly portable.

6. Efficiency: C's design allows for high performance and efficient use of system resources,
making it suitable for developing software that requires high-speed execution and low
overhead.

7. Flexibility: C allows for a high degree of flexibility in programming, enabling developers to


implement complex algorithms and data structures with ease.

8. Extensibility: C supports the use of user-defined functions and data types, allowing
programmers to extend the language's capabilities to suit their specific needs.

Structure of C program

The structure helps us analyze the format to write a program for the least errors. It gives
better clarity & concept of program.

The structure of a language gives us a basic idea of the order of the sections in a program.
We get to know when & where to use a particular statement, variable, function, curly braces,
parentheses etc.
It consists of 6 sections:

1. Documentation section: It includes the statement specified at the beginning of a


program such as program’s name, date, description & title. It is represented by:
//name of the program
Or
/* date: -
Name: -
*/
It provides an overview of the program. Anything written inside will be considered a
part of the documentation section & will not interfere with the specified code.
2. Preprocessor section: It contains all the header files used in program. It informs the
system to link the header files to the system libraries. It is represented as:
#include<stdio.h>
The #include statement includes the specific file as a part of a function at the time of
compilation. #include<stdio.h> consist of a contents of the standard input output files,
which contains the definition of stdin, stdout & stderr.
There are various header files available for different purposes like #include<math.h>.
It is used for mathematical function in a program.
3. Definition section: the definition section comprises of different constants declared
using the define keyword. It is given by:
#define MAX 100
4. Global declaration: It comprises of all the global declarations in the program. It is
given by:
float num = 3.5;
int a = 4;
char c = ‘z’;
5. Main function: main () is the first function to be executed by the computer. It is
necessary for a code to include the main (). The main () function is declared as:
main ()
We can also use int or void with main (). The void main () specifies that the program
will not return any value. The int main () specifies that the program can return integer
data type.
Main function further categorized into local declarations, statements & expressions.
6. User defined functions: these specified functions as per requirements of the user.
Example: color (), sum (), division () etc.

Character set : In C programming, a character set refers to the set of characters that the
language recognizes and can use in the source code. These characters are categorized
into several groups:

1. Letters

• Uppercase Letters: A to Z
• Lowercase Letters: a to z
2. Digits

• Digits: 0 to 9

3. Special Characters

• Punctuation: , . ; : ? ' " !


• Arithmetic Operators: + - * / %
• Relational Operators: > < >= <= == !=
• Logical Operators: && || !
• Bitwise Operators: & | ^ ~ << >>
• Miscellaneous: # $ @ _ \ [ ] { } ( ) and others like ~, ^, &, *, -, =, etc.

You might also like