0% found this document useful (0 votes)
8 views3 pages

Unit 1 C Programming Notes

C programming language, developed by Dennis Ritchie in 1972, serves as a foundation for modern programming languages and is used for system software development. It features a structured program format, including header files, main function, and various data types, while employing a compiler to convert source code into machine code. Key concepts include keywords, variables, input/output functions, and operator hierarchy, making C a powerful tool for efficient software development.

Uploaded by

priyamm1007
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)
8 views3 pages

Unit 1 C Programming Notes

C programming language, developed by Dennis Ritchie in 1972, serves as a foundation for modern programming languages and is used for system software development. It features a structured program format, including header files, main function, and various data types, while employing a compiler to convert source code into machine code. Key concepts include keywords, variables, input/output functions, and operator hierarchy, making C a powerful tool for efficient software development.

Uploaded by

priyamm1007
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

UNIT 1 – Introduction to C Programming

1. Evolution of C

C language was developed by Dennis Ritchie in 1972 at Bell Laboratories. It is a


structured, general-purpose programming language used for developing system software
like operating systems and compilers. C language is considered the foundation of modern
programming languages like C++, Java, and Python.

2. Programming Languages

Programming languages are used to communicate with computers. They are divided into
three categories:

- Machine Language: Written in binary (0s and 1s), directly understood by the computer.

- Assembly Language: Uses short codes (mnemonics) instead of binary, needs an


assembler.

- High-Level Language: Human-readable and easy to learn (like C, Java, Python).

3. Structure of a C Program

A C program follows a particular structure which includes:

1. Header Files (e.g., #include)

2. main() Function – the starting point of every C program

3. Declaration Section – variable declaration

4. Statements / Logic

5. Output Section – displaying results using printf()

Example:

#include<stdio.h>
void main(){
int a,b,sum;
sum=a+b;
printf('%d',sum);
}
4. Compiling a C Program

The compiler converts the source code (written by the programmer) into machine code.
Steps: Writing → Compiling → Linking → Executing.

5. Character Set in C

The character set includes all characters that C can recognize, such as:

- Alphabets (A–Z, a–z)


- Digits (0–9)
- Special Symbols (+, -, *, /, =, <, >, etc.)
- White spaces and escape sequences.

6. Keywords

Keywords are reserved words with fixed meanings used by the compiler. Examples: int,
float, char, if, else, while, for, return, break, continue, switch, void, etc.

7. Data Types

Data types define the type of data a variable can store.

- int → stores integers (e.g., 10, -5)


- float → stores decimal numbers (e.g., 3.14)
- char → stores single character (e.g., 'A')

8. Variables

A variable is a name given to a memory location that stores data. Syntax: data_type
variable_name;

Example: int marks = 90;

9. Type Declaration

Used to declare variables before using them. Example: float avg; int total;

10. Input / Output Functions

- Input function: scanf() is used to take user input.


Example: scanf('%d', &a;);
- Output function: printf() is used to display output.
Example: printf('%d', a);

11. Format Specifiers

They define the type of data being printed or scanned.


%d → integer
%f → float
%c → character
%s → string

12. Operators in C

Operators are special symbols used to perform operations.

- Arithmetic: +, -, *, /, %
- Relational: <, >, <=, >=, ==, !=
- Logical: &&, ||, !
- Unary: ++, --
- Assignment: =, +=, -=, *=, /=

13. Operator Hierarchy (Priority)

Defines the order in which operations are performed:

1. ()
2. * / %
3. + -
4. < > <= >= == !=
5. && ||
6. =

Summary:

C language is simple, structured, and efficient. It provides strong control over hardware
and helps in developing fast, portable, and reliable software.

You might also like