Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
ОПК, семинар №8
Search
Ilya
March 12, 2015
Education
58
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ОПК, семинар №8
Указатели на функции
Ilya
March 12, 2015
More Decks by Ilya
See All by Ilya
Программирование на ЯВУ, семинар 3
ilya
0
170
Программирование на ЯВУ, семинар 2
ilya
0
75
ОПК, семинар №6
ilya
0
79
ОПК, семинар №4
ilya
0
110
ОПК, семинар №2
ilya
0
93
Other Decks in Education
See All in Education
AI Generated Beer
lonbrew
0
120
武藤の処世術を書いてみた
mutomasa
0
120
!コスパよくインターンに受かる方法!
ruribou
1
360
マークシート試験のTeX言語を用いた自動採点について
doratex
0
3.4k
Portable & Reproducible Research Environments in the Age of AI Agents
denkiwakame
0
720
0526
cbtlibrary
0
280
Examen de Selectividad. Geografía junio 2026 (Convocatoria Ordinaria). UCLM
juanmartin2026
1
6.6k
[2026前期火5] 論理学(京都大学文学部 前期 第8回)「正規化定理の証明」
yatabe
0
330
批判的応用言語学ワークショップ(2026-08-12 お茶の⽔⼥⼦⼤学)
terasawat
0
190
学生のうちに考えておきたい信頼の話
suisan
1
780
良書紹介08_ 頭のいい子がやっているすごいグラフの読み方
bunnchinn3
0
160
中小規模私大の教学IRを支えるデータマネジメント ― データ基盤構築の取り組みと実務の現在地 ―
terazawa
0
150
Featured
See All Featured
Become a Pro
speakerdeck
PRO
31
6.3k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
350
GraphQLとの向き合い方2022年版
quramy
50
15k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
For a Future-Friendly Web
brad_frost
183
10k
Exploring anti-patterns in Rails
aemeredith
4
510
GitHub's CSS Performance
jonrohan
1033
470k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
A Soul's Torment
seathinner
8
3.6k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.8k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
410
Transcript
Указатели на функции
#include <stdio.h> #include <stdlib.h> double long_calculation(double x, unsigned n) {
double result = 1.0; unsigned i; for(i = 0; i < n; i++) { result *= x; sleep(1); } return result; } int main() { double my_power = long_calculation(2.0, 5); printf("Result: %lf\n", my_power); return 0; }
Callbacks void printer(int i) { printf("Progress: %d%% complete\n", i); }
int main() { void (*printer_func)(int); printer_func = &printer; printer_func(20); return 0; }
double long_calculation(double x, unsigned n, void (*callback)(int)) { double result
= 1.0; unsigned i, progress; for(i = 0; i < n; i++) { result *= x; progress = (unsigned) (((double) i)/ n * 100); callback(progress); sleep(1); } return result; }
typedef void (*callback_func)(int); double long_calculation(double x, unsigned n, callback_func callback);
int main() { callback printer_func = &printer; double my_power = long_calculation(2.0, 3, printer_func); printf("Result: %lf\n", my_power); return 0; }
void bubble_sort(int *base, size_t size) { int temp; size_t i,
j; for(i = 0; i < size; i++) { for(j = i; j < size; j++) { if(base[i] > base[j]) { temp = base[i]; base[i] = base[j]; base[j] = temp; } } } } Абстракция
int main() { int array[] = {1, 9, 5, 4,
7, 2, 4, 6}; size_t length = sizeof(array)/sizeof(int); bubble_sort(array, length); size_t i; for(i = 0; i < length; i++) { printf("%d ", array[i]); } printf("\n"); return 0; }
void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *,
const void *)); int greater_than(const void* pleft, const void* pright) { int left = *(int*) pleft; int right = *(int*) pright; return left > right; } qsort(array, length, sizeof(int), greater_than);
int less_than(const void* pleft, const void* pright) { int left
= *(int*) pleft; int right = *(int*) pright; return left < right; } qsort(array, length, sizeof(int), less_than);
void (*signal(int, void(*)(int)))(int); Ужасы языка С
typedef void (*signal_handler)(int signum); void (*signal(int, void(*)(int)))(int); signal_handler signal(int signum,
signal_handler handler);