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

C Programming Notes

This document provides an overview of C programming, covering its introduction, structure, basic syntax, data types, variables, input/output, operators, control statements, functions, arrays, pointers, structures, and file handling. It includes code examples to illustrate key concepts. The notes serve as a comprehensive guide for beginners learning C programming.
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)
59 views3 pages

C Programming Notes

This document provides an overview of C programming, covering its introduction, structure, basic syntax, data types, variables, input/output, operators, control statements, functions, arrays, pointers, structures, and file handling. It includes code examples to illustrate key concepts. The notes serve as a comprehensive guide for beginners learning C programming.
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

C Programming Notes: Step-by-Step

1. Introduction to C

- C is a general-purpose, procedural programming language.

- Developed by Dennis Ritchie in 1972.

- Used for system programming, developing operating systems, and embedded systems.

2. Structure of a C Program

#include <stdio.h>

int main() {

printf("Hello, World!");

return 0;

3. Basic Syntax

- Semicolon (;) marks the end of a statement.

- Braces {} define a block of code.

- Comments: Single-line (//) and multi-line (/* ... */).

4. Data Types

int - Integer (e.g., 5, -3)

float - Floating-point (e.g., 3.14)

char - Character (e.g., 'A')

double - Double-precision float

void - No value
5. Variables and Constants

int x = 10;

const float PI = 3.14;

6. Input and Output

int a;

scanf("%d", &a);

printf("%d", a);

7. Operators

Arithmetic: +, -, *, /, %

Relational: ==, !=, >, <

Logical: &&, ||, !

8. Control Statements

if, else if, else

switch statement

for, while, do-while loops

break, continue

9. Functions

int add(int a, int b) {

return a + b;

}
10. Arrays and Strings

Array: int arr[5];

String: char name[20];

11. Pointers

int a = 10;

int *p = &a;

printf("%d", *p);

12. Structures and Unions

struct Student {

int id;

char name[20];

};

13. File Handling

FILE *fp = fopen("file.txt", "r");

fclose(fp);

You might also like