C Programming • C Basics, Operators, Loops
C Programming / Introduction to C

Introduction to C

Notes 2 C Basics, Operators, Loops

C is a general-purpose, procedural programming language used to write programs for solving different types of problems. It is a high-level language that also provides features for working closely with computer hardware.

Notes

Introduction to C

C is a general-purpose, procedural programming language used to write programs for solving different types of problems. It is a high-level language that also provides features for working closely with computer hardware.

💡 In Simple Words

C is a programming language used to give instructions to a computer and develop programs in a clear and structured way.

Features of C

Feature Simple Explanation
Simple C has a relatively small set of keywords and a clear syntax.
Procedural A program can be divided into functions and step-by-step procedures.
Portable C programs can be moved to different systems with suitable changes or recompilation.
Fast and Efficient C programs can execute efficiently and provide good control over system resources.
Structured Programs can be organized into functions and logical blocks.
Middle-Level Features C combines high-level programming features with low-level operations such as pointers and direct memory access.
Rich Operators C provides operators for arithmetic, comparison, logic, assignment and other operations.

Basic C Program Structure

A basic C program contains different parts such as header files, the main() function, declarations or statements, and the return statement.

#include <stdio.h> int main() { // declarations and statements return 0; }

1. Header File

Header files provide declarations for functions and other definitions used by a program. For example, #include <stdio.h> provides standard input and output functions such as printf() and scanf().

2. main() Function

The main() function is the entry point of a normal C program. Program execution begins from main().

3. Statements

Statements are the instructions that perform the required operations of the program.

4. return 0;

The return 0; statement indicates successful completion of the main() function.

Simple C Program Example

#include <stdio.h> int main() { int a = 10; int b = 15; int sum = a + b; printf("Sum = %d", sum); return 0; }

Output

Sum = 25

How the Program Works

  1. #include <stdio.h> provides standard input/output functions.
  2. The program starts from main().
  3. Variables a and b store the two numbers.
  4. sum = a + b calculates their sum.
  5. printf() displays the result.
  6. return 0; ends the program successfully.
📌 Remember

The basic idea of a C program is: Header → main() → Statements → return 0

Quick Revision

Concept Remember
C General-purpose procedural programming language.
Portable Can be adapted to different systems.
main() Program execution starts here.
stdio.h Provides standard input/output functions.
printf() Used to display output.
return 0; Indicates successful completion of main().

Important Exam Questions

Short Answer Questions

  1. What is C?
  2. Write any four features of C.
  3. What is the purpose of the main() function?
  4. What is the use of #include <stdio.h>?
  5. What is the purpose of return 0;?
  6. Write the basic structure of a C program.

Long Answer Questions

  1. Explain C and its important features.
  2. Explain the basic structure of a C program with a suitable example.
  3. Write a simple C program to add two numbers and explain its structure.
🎥 Recommended Learning

Watch a beginner-friendly introduction to C programming, its features and basic program structure.

▶ Watch: Introduction to C Programming — Hindi

📝 Handwritten Notes

A short handwritten-style revision sheet covering C features and basic program structure will be provided here.

🧠 Mind Map

Use the mind map for quick revision of C, its features and basic program structure.