Skip to content

Commit 66f14ff

Browse files
first commit
0 parents  commit 66f14ff

15 files changed

+650
-0
lines changed

Diff for: .vscode/tasks.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"tasks": [
3+
{
4+
"type": "cppbuild",
5+
"label": "C/C++: gcc.exe build active file",
6+
"command": "C:\\MinGW\\bin\\gcc.exe",
7+
"args": [
8+
"-fdiagnostics-color=always",
9+
"-g",
10+
"${file}",
11+
"-o",
12+
"${fileDirname}\\${fileBasenameNoExtension}.exe"
13+
],
14+
"options": {
15+
"cwd": "${fileDirname}"
16+
},
17+
"problemMatcher": [
18+
"$gcc"
19+
],
20+
"group": {
21+
"kind": "build",
22+
"isDefault": true
23+
},
24+
"detail": "Task generated by Debugger."
25+
}
26+
],
27+
"version": "2.0.0"
28+
}

Diff for: 1.c

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <stdio.h> // Pre processor command
2+
3+
int main(int argc, char const *argv[]) // program starts from main(), int as it returns integer
4+
{
5+
printf("Hello world!");
6+
return 0;
7+
}
8+
9+
// .exe file of this does not auto-change itself so have to make different .exe everytime

Diff for: 1.exe

30.5 KB
Binary file not shown.

Diff for: 2.exe

31.1 KB
Binary file not shown.

Diff for: 2_taking_input.c

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <stdio.h>
2+
3+
int main(int argc, char const *argv[])
4+
{
5+
int a,b;
6+
printf("Enter number a\n");
7+
scanf("%d",&a);
8+
9+
printf("Enter number b\n");
10+
scanf("%d",&b);
11+
12+
printf("The sum of %d and %d is %d\n",a,b,a+b);
13+
printf("The differene %d - %d is %d\n",a,b,a-b);
14+
printf("The multiplication of %d and %d is %d\n",a,b,a*b);
15+
printf("The quotienf of %d/%d is %d\n",a,b,a/b);
16+
return 0;
17+
}

Diff for: 3_synatx_of_c.c

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Tokens
2+
3+
#include <stdio.h>
4+
5+
int main(void)
6+
{
7+
printf
8+
(
9+
"Hello world \n"
10+
)
11+
;
12+
return 0;
13+
}
14+
15+
// each line = one token

Diff for: 4_variable.c

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <stdio.h>
2+
3+
int main(void)
4+
{
5+
// deceleration
6+
int a;
7+
// initialization
8+
a = 78;
9+
// deceleration and initialization
10+
int b = 90;
11+
12+
13+
return 0;
14+
}
15+
16+
/*RULES of decleration of variable:
17+
18+
) Can contain alphabets,digits,underscore
19+
) Cannot start with digit
20+
) No space and no reserved keyword is allowed
21+
22+
*/
23+
24+
// memory = RAM for any program

Diff for: 5_data_type.c

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#include <stdio.h>
2+
3+
int main(void)
4+
{
5+
// for my (64-bit) artecture
6+
printf("%lu \n",sizeof(int)); // returns 4 bytes
7+
printf("%lu \n",sizeof(unsigned int));
8+
printf("%lu \n",sizeof(long int));
9+
return 0;
10+
}
11+
12+
/*
13+
Basic data types
14+
15+
1) int
16+
2) char
17+
3) float
18+
4) double
19+
20+
Derived data type
21+
22+
1) array
23+
2) pointer
24+
3) structure
25+
4) union
26+
27+
Enumeration data type
28+
29+
1) enum
30+
31+
Void data type
32+
33+
1) void
34+
35+
*/
36+
37+
/* int derivatives (for 32-bit artitecture)
38+
39+
int, signed int, short int, signed short int : -32,000 to 32,000 ( -32,768 to 32,767 )
40+
unsigned int, unsigned short int : 0 to 65,000 ( 0 to 65535)
41+
long int, signed long int : -2 billion to 2 billion
42+
unsigned long int : 0 to 4 billion
43+
44+
------------> Varies artitecture to artitecture
45+
*/

Diff for: 5_data_type.exe

30.5 KB
Binary file not shown.

Diff for: 6_operators.c

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <stdio.h>
2+
3+
int main(void){
4+
5+
}
6+
7+
/*
8+
OPERATORS : Symbol which make 2 operands one
9+
10+
// Arithematic operators + , - , * , / , %
11+
12+
// Relation operatos == , != , > , < , >= , <= ( 0 = false, 1 = true)
13+
14+
// Logical operatos && , || , !
15+
16+
*/

Diff for: Working_of_c/main.c

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <stdio.h>
2+
3+
int main(int argc, char const *argv[])
4+
{
5+
printf("Hello world!");
6+
return 0;
7+
}
8+
9+
/*
10+
Processes in c compilation
11+
12+
1) Pre-processing : Removes comments, expand macros and resolve # commands (literally copy pastes the stdio.h file content) --> Generates .i file
13+
2) Compilation : Changes high level language to assembly language --> Generates .s
14+
3) Assembly : Changes assembly language to binary --> Generates .o
15+
4) Linker : Links all binary .o files (sil deta hai) --> Generates .exe
16+
17+
IS OE
18+
*/

Diff for: Working_of_c/main.exe

30.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)