Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Программирование на ЯВУ, семинар 2
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Ilya
September 08, 2015
Education
74
0
Share
Программирование на ЯВУ, семинар 2
Ilya
September 08, 2015
More Decks by Ilya
See All by Ilya
Программирование на ЯВУ, семинар 3
ilya
0
170
ОПК, семинар №8
ilya
0
56
ОПК, семинар №6
ilya
0
77
ОПК, семинар №4
ilya
0
110
ОПК, семинар №2
ilya
0
89
Other Decks in Education
See All in Education
0506
cbtlibrary
0
150
면접관 눈에 띄는 데이터 분석 포트폴리오 만드는 법 | 2026년 5월 세미나
datarian
0
180
LinkedIn
matleenalaakso
0
4.1k
小さなまちで始める デジタル創作の居場所〜すべての子どもが創造的に未来を描ける社会へ〜
codeforeveryone
0
490
Liberalism's Last Man and Asia
vyadav
0
120
Laura Wilson - The Quarterly PR Pivot
laurawilsonbseo1
1
270
Curso de Consagração ao Sagrado Coração de Jesus - O Sagrado Coração na História (Aula 01)
cm_manaus
0
150
JAWS-UG初心者支部#81 GWにEduJAWSと何か作ろうもくもく会!
otsuki
0
100
Alumnote inc. Company Deck
yukinumata
1
17k
Data Physicalisation - Lecture 9 - Next Generation User Interfaces (4018166FNR)
signer
PRO
1
970
勾配ブースティングと決定木の話 / gradient boosting and decision trees
kaityo256
PRO
6
1.2k
fake vs real
latrrr
0
120
Featured
See All Featured
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
250
So, you think you're a good person
axbom
PRO
2
2k
Rails Girls Zürich Keynote
gr2m
96
14k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
510
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
340
From π to Pie charts
rasagy
0
180
Deep Space Network (abreviated)
tonyrice
0
140
A Tale of Four Properties
chriscoyier
163
24k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
280
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Transcript
http://en.cppreference.com/w/c http://learnxinyminutes.com/docs/c/ https://en.wikibooks.org/wiki/C_Programming http://c.learncodethehardway.org/book/ Kernigan and Ritchie: The C Programming
Language (K&R) Полезное про C
http://immersivemath.com/ila/index.html http://visualgo.net/ Полезное
void swap(double arr[]) { double x; x = arr[0]; arr[0]
= arr[1]; arr[1] = x; } void main() { double arr[2]; arr[0] = 1.0; arr[1] = 2.0; swap(arr); printf("%f %f\n", arr[0], arr[1]); } > 2.000000 1.000000 Массивы и функции
Нужно больше stdlib.h #include <math.h> printf("%f %2.f %.2f\n", M_PI, M_PI,
M_PI); > 3.141593 3 3.14 printf("%e %2.e %.2e\n", M_PI, M_PI, M_PI); > 3.141593e+00 3e+00 3.14e+00
#include <stdio.h> #include <stdlib.h> void main() { int i, number;
for(i = 0; i < 5; i++) { number = rand() % 100; printf("%d: %d\n", i, number); } } > 0: 83 > 1: 86 > 2: 77 > 3: 15 > 4: 93 Случайные числа
assert.h int factorial(int n) { // вырезано цензурой } void
main() { int i, result; for(i = 1; i < 6; i++) { result = factorial(i); printf("%d! = %d\n", i, result); } } > 1! = 1 > 2! = 2 > 3! = 6 > 4! = 24 > 5! = 120
printf("%d! = %d\n", -5, factorial(-5)); Segmentation fault (core dumped)
int factorial(int n) { assert(n >= 0); // вырезано цензурой
} printf("%d! = %d\n", -5, factorial(-5)); main: main.c:5: factorial: Assertion `n >= 0' failed. Aborted (core dumped)
Тестирование int celsius_to_fahrenheit(int c) { // } int fahrenheit_to_celsius(int f)
{ // } void main() { printf("%d\n", celsius_to_fahrenheit(30)); // 86 assert(celsius_to_fahrenheit(30) == 86); assert(fahrenheit_to_celsius(86) == 30); assert(celsius_to_fahrenheit(0) == 32); assert(fahrenheit_to_celsius(32) == 0); }
Стиль // Вычисление 2*X^2 + 3*X — 5 для X
int some_fun(int i) { int j=2,k,l=3,m,n=-5; if(i!=0) return j*i*i+l*i+n; else {printf("invalid x %d",i);} return -5; }
int polynomial(int x) { int a = 2, b =
3, c = -5; if(x == 0) { printf("Not a very interesting x\n"); return c; } else { return a * pow(x, 2) + b * pow(x, 1) + c; } }
Константы int i; int a[7]; // Ещё хуже, когда a[5]
for(i = 0; i < 6; i++) { a[i] = pow(10, i); printf("%d ", a[i]); } // Совсем плохо, когда так: for(i = 0; i < 6; i++) { ... for(i = 0; i < 6; i++) { ... for(i = 0; i < 6; i++) { ... for(i = 0; i < 6; i++) { ... for(i = 0; i < 6; i++) {
const unsigned size = 6; void main() { int i;
int a[size]; for(i = 0; i < size; i++) { a[i] = pow(10, i); printf("%d ", a[i]); } }