CLASS 10 SEE – C PROGRAMMING

 

IMPORTANT THEORY NOTES


1. Introduction to C Programming

  • C is a high-level structured programming language.

  • It was developed by Dennis Ritchie in 1972 at AT&T Bell Laboratories.

  • C is used to develop system software, application software, and embedded systems.


2. Features of C Language

  • Simple and easy to learn

  • Structured and modular

  • Portable (machine independent)

  • Fast execution

  • Supports low-level programming


3. Structure of a C Program

  1. Documentation section

  2. Link section (#include <stdio.h>)

  3. Definition section (#define)

  4. Global declaration section

  5. main() function

  6. User-defined functions


4. Keywords

  • Keywords are reserved words in C.

  • They have fixed meanings and cannot be used as identifiers.

  • Examples: int, float, if, else, while, for, return


5. Variables

  • A variable is a named memory location used to store data.

  • The value of a variable can change during program execution.

Example:

int a;

6. Constants

  • Constants are fixed values that do not change during program execution.

Example:

#define PI 3.14

7. Data Types

Data types specify the type of data stored in a variable.

Data TypeDescription
intInteger numbers
floatDecimal numbers
charSingle character
doubleLarge decimal numbers

8. Operators

Operators are symbols used to perform operations.

Types of Operators:

  • Arithmetic: + - * / %

  • Relational: > < >= <= == !=

  • Logical: && || !

  • Assignment: =


9. Input and Output Functions

  • scanf() is used to take input from the user.

  • printf() is used to display output.

Example:

scanf("%d", &a);
printf("%d", a);

10. Format Specifiers

SpecifierMeaning
%dInteger
%fFloat
%cCharacter
%sString

11. Decision Making Statements

Used to make decisions based on conditions.

  • if

  • if...else

  • else if


12. Looping Statements

Loops are used to repeat statements.

Types of Loops:

  1. for loop

  2. while loop

  3. do...while loop


13. Difference Between for and while Loop

for loopwhile loop
Iterations are knownIterations are unknown
Initialization inside loopInitialization outside loop

14. Array

  • An array is a collection of similar data types.

  • It stores multiple values using a single variable name.

Example:

int a[5];

15. Function

  • A function is a block of code that performs a specific task.

  • It improves code reusability.

Types of Functions:

  • Library function

  • User-defined function


16. Header File

  • A header file contains function declarations.

  • Examples: stdio.h, conio.h


17. Compiler

  • A compiler translates the whole program at once.

  • Errors are shown after compilation.

Example: GCC


18. Types of Errors

  1. Syntax Error – Grammar mistake

  2. Logical Error – Wrong output

  3. Runtime Error – Occurs during execution


19. Comments

  • Comments are non-executable statements.

  • Used to explain the program.

Types:

  • Single-line comment: //

  • Multi-line comment: /* */


20. Algorithm

  • An algorithm is a step-by-step procedure to solve a problem.

  • Characteristics: finite, definite, effective


EXAM WRITING TIPS

  • Write answers in points

  • Use keywords from the question

  • Draw tables for differences

  • Underline important terms

Comments