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

C Programming Basics Notes

C is a general-purpose, procedural programming language developed by Dennis Ritchie in 1972, used for system programming and low-level memory management. A C program typically includes a preprocessor directive, a main function, and utilizes various data types such as int, float, char, and double. The document also covers variables, constants, input/output functions, and operators, along with a simple example code demonstrating basic arithmetic operations.

Uploaded by

mahindrathar12
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 Programming Basics Notes

C is a general-purpose, procedural programming language developed by Dennis Ritchie in 1972, used for system programming and low-level memory management. A C program typically includes a preprocessor directive, a main function, and utilizes various data types such as int, float, char, and double. The document also covers variables, constants, input/output functions, and operators, along with a simple example code demonstrating basic arithmetic operations.

Uploaded by

mahindrathar12
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 - Basic Notes

1. Introduction to C

C is a general-purpose, procedural programming language.

Developed by Dennis Ritchie in 1972 at Bell Labs.

Used in system programming, embedded systems, and low-level memory management.

2. Structure of a C Program

#include <stdio.h>

int main() {

// Your code here

return 0;

- #include <stdio.h> : Preprocessor directive to include header

- main() : Entry point of a C program

- printf() : Used for output

- return 0; : Ends the program successfully

3. Data Types in C

- int : Integer numbers (e.g., int x = 10;)

- float : Decimal numbers (e.g., float y = 5.5;)

- char : Single character (e.g., char ch = 'A';)

- double : Larger decimal numbers (e.g., double d = 9.81;)

4. Variables and Constants


C Programming - Basic Notes
- Variable: A named space in memory to store data (e.g., int age = 20;)

- Constant: Fixed value that cannot be changed (e.g., const float PI = 3.14;)

5. Input and Output

Example:

#include <stdio.h>

int main() {

int age;

printf("Enter age: ");

scanf("%d", &age);

printf("Your age is %d", age);

return 0;

- printf(): Displays output

- scanf(): Takes input from user

6. Operators

- Arithmetic: +, -, *, /, %

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

- Logical: &&, ||, !

- Assignment: =, +=, -=, etc.

7. Simple Example Code


C Programming - Basic Notes
#include <stdio.h>

int main() {

int a = 5, b = 3;

int sum = a + b;

printf("Sum is %d", sum);

return 0;

You might also like