Back to C learning
This commit is contained in:
commit
c09145a0f5
9 changed files with 123 additions and 0 deletions
58
.gitignore
vendored
Normal file
58
.gitignore
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
# ---> C
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Linker output
|
||||
*.ilk
|
||||
*.map
|
||||
*.exp
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
|
||||
# Kernel Module Compile Results
|
||||
*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
|
||||
.DS_Store
|
||||
|
||||
.vscode*
|
||||
./build/*
|
2
README.md
Normal file
2
README.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
# c_programming_language
|
||||
|
Binary file not shown.
BIN
build/celcius
Executable file
BIN
build/celcius
Executable file
Binary file not shown.
BIN
c_modern_approach/Fundamentials/2_001_section
Executable file
BIN
c_modern_approach/Fundamentials/2_001_section
Executable file
Binary file not shown.
7
c_modern_approach/Fundamentials/2_001_section.c
Normal file
7
c_modern_approach/Fundamentials/2_001_section.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <stdio.h>
|
||||
int main(void) {
|
||||
printf("Privet Sashka kak dela");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
13
c_modern_approach/Fundamentials/README.md
Normal file
13
c_modern_approach/Fundamentials/README.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Шаги запуска программы
|
||||
Preprocessing -> Compiling -> Linking
|
||||
|
||||
## Preprocessing
|
||||
Первый шаг - команда попадает сюда. Тут препроцессор выполняет команды, которые начинаются с `#`. These commands are called **Directives**
|
||||
|
||||
## Compiling
|
||||
After Preprocessing app goes to compiler where app is being translated into machine instructions (object code)
|
||||
|
||||
## Linking
|
||||
Linker combines object code from step 2 with additional code needed for final executable. This code includes library functions
|
||||
|
||||
P.S.: *Сори за микс языков, лень было переключаться в процессе*
|
31
labs/part1/celcius.c
Normal file
31
labs/part1/celcius.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
#include <stdio.h>
|
||||
#define LOWER 0
|
||||
#define UPPER 300
|
||||
#define STEP 20
|
||||
|
||||
int main() {
|
||||
float fahr, celsius;
|
||||
int lower, upper, step;
|
||||
|
||||
fahr = LOWER;
|
||||
printf("Temperature conversion\n");
|
||||
while (fahr <= UPPER) {
|
||||
celsius = (5.0 / 9.0) * (fahr - 32.0);
|
||||
printf("%3.0f\t%6.1f\n", fahr, celsius);
|
||||
fahr = fahr + STEP;
|
||||
}
|
||||
|
||||
printf("\nNow Celcius -> Fahr table\n");
|
||||
lower = 0;
|
||||
upper = 100;
|
||||
step = 5;
|
||||
fahr = 0.0;
|
||||
celsius = lower;
|
||||
while (celsius <= upper) {
|
||||
fahr = (celsius * (9.0 / 5.0)) + 32;
|
||||
printf("%3.0f\t%6.1f\n", celsius, fahr);
|
||||
celsius = celsius + step;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
12
labs/part1/hello.c
Normal file
12
labs/part1/hello.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
int div_result;
|
||||
printf("hello world\n");
|
||||
printf("Test\tTab\n");
|
||||
printf("Test backspace\b\b\b");
|
||||
printf("Test\tc_word\a\n");
|
||||
div_result = 6/5;
|
||||
printf("Result: %d", div_result);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue