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

C Language Notes

C Language is a general-purpose programming language used for system software, operating systems, compilers, embedded systems, and applications. The document outlines the basic structure of a C program, key components like variables, data types, operators, conditional statements, loops, arrays, strings, functions, pointers, structures, and file handling. It also includes a simple program example and tips for exam preparation.

Uploaded by

jetofek183
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)
4 views3 pages

C Language Notes

C Language is a general-purpose programming language used for system software, operating systems, compilers, embedded systems, and applications. The document outlines the basic structure of a C program, key components like variables, data types, operators, conditional statements, loops, arrays, strings, functions, pointers, structures, and file handling. It also includes a simple program example and tips for exam preparation.

Uploaded by

jetofek183
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 Language Notes

1. C Language kya hai?


C ek general-purpose programming language hai. Iska use system software, operating system, compiler,
embedded systems aur applications banane me hota hai.

2. Basic Structure
#include <stdio.h>
int main() {
printf("Hello World");
return 0;
}

3. Header File
#include <stdio.h>
stdio.h input/output functions ke liye use hota hai, jaise printf() aur scanf().

4. main() Function
Program execution main() function se start hota hai.

5. printf()
Output dikhane ke liye:
printf("Hello");

6. scanf()
User se input lene ke liye:
int a;
scanf("%d", &a);

7. Variables
Data store karne ke liye variable use hota hai.
int age = 20;
float marks = 85.5;
char grade = 'A';

8. Data Types
int: Integer number, float: Decimal number, char: Single character, double: Large decimal number.

9. Operators
+ Addition, - Subtraction, * Multiplication, / Division, % Remainder.

10. Conditional Statement


if (age >= 18) {
printf("Adult");
}
if (marks >= 33) {
printf("Pass");
} else {
printf("Fail");
}
11. Loops
for (int i = 1; i <= 5; i++) {
printf("%d\n", i);
}
int i = 1;
while (i <= 5) {
printf("%d\n", i);
i++;
}

12. Array
Same type ke multiple values store karne ke liye.
int marks[5] = {80, 70, 90, 60, 85};
printf("%d", marks[0]);

13. String
Characters ka collection.
char name[20] = "Rahul";
printf("%s", name);

14. Function
int add(int a, int b) {
return a + b;
}
printf("%d", add(5, 3));

15. Pointer
int a = 10;
int *p = &a;
printf("%d", *p);

16. Structure
struct Student {
int roll;
char name[20];
float marks;
};

17. File Handling


FILE *fp;
fp = fopen("[Link]", "w");
fprintf(fp, "Hello C");
fclose(fp);

18. Important Keywords


int, float, char, if, else, for, while, do, switch, case, break, continue, return, struct, void

19. Simple Program: Add Two Numbers


#include <stdio.h>
int main() {
int a, b, sum;
printf("Enter two numbers: ");
scanf("%d %d", &a, &b);
sum = a + b;
printf("Sum = %d", sum);
return 0;
}
20. Exam Tips
Syntax clearly yaad rakho. Semicolon lagana na bhulo. scanf() me & use karo. Loops aur functions practice karo. Pr

You might also like