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

C Language Notes

The document provides an overview of the C programming language, highlighting its development by Dennis Ritchie in 1972 and its key features such as procedural and structured programming. It covers essential components of a C program, including syntax, data types, variables, operators, control statements, functions, arrays, strings, pointers, structures, and file handling. Each section includes examples to illustrate the concepts discussed.

Uploaded by

rohannishad144
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)
2 views3 pages

C Language Notes

The document provides an overview of the C programming language, highlighting its development by Dennis Ritchie in 1972 and its key features such as procedural and structured programming. It covers essential components of a C program, including syntax, data types, variables, operators, control statements, functions, arrays, strings, pointers, structures, and file handling. Each section includes examples to illustrate the concepts discussed.

Uploaded by

rohannishad144
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/ 3

C LANGUAGE NOTES

1. Introduction to C

- Developed by: Dennis Ritchie (1972)

- Features: Procedural, Structured, Low-level memory access, Fast

- Uses: System software, Embedded systems, Compilers

2. Structure of a C Program

#include <stdio.h>

int main() {

printf("Hello, World!");

return 0;

3. Basic Syntax

- Semicolon (;): Ends a statement

- Comments:

// Single-line

/* Multi-line */

4. Data Types

- int: 2 or 4 bytes (e.g., 10)

- float: 4 bytes (e.g., 3.14)

- char: 1 byte (e.g., 'A')

- double: 8 bytes (e.g., 3.14159)

5. Variables & Constants


int a = 10;

const float pi = 3.14;

6. Operators

- Arithmetic: + - * / %

- Relational: == != > < >= <=

- Logical: && || !

- Assignment: = += -= *=

7. Input & Output

scanf("%d", &a); // Input

printf("%d", a); // Output

8. Control Statements

- if, else if, else

- switch case

- Loops: for, while, do...while

Example:

for (int i = 0; i < 5; i++) {

printf("%d", i);

9. Functions

int add(int a, int b) {

return a + b;

}
10. Arrays

int arr[5] = {1, 2, 3, 4, 5};

11. Strings

char name[] = "Rohan";

12. Pointers

int a = 10;

int *ptr = &a;

13. Structures

struct Person {

char name[20];

int age;

};

14. File Handling

FILE *fp;

fp = fopen("data.txt", "r");

fclose(fp);

You might also like