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
オンラインコミュニティ TRY部 体験マニュアル
ytapples613
0
370
[2026前期火5] 論理学(京都大学文学部 前期 第11回)「ハーモニー:三層モデルと保存拡大」
yatabe
0
300
第2部-高校生とAI活用/high-school2026-2
okana2ki
0
200
マークシート試験のTeX言語を用いた自動採点について
doratex
0
4.6k
Book-keeping
bvr7352
0
120
【新規入学者様】ainiチャット操作ガイド
ainischool
0
140
未踏峰連山 Frontiers: Creating and Conquering Untrodden Peaks
ishii_mit
1
160
Introduction to M&A
bvr7352
0
220
【新規入学者様】ZEPメタバース校舎ガイド
ainischool
0
170
検定資格の価値 ~実はすごいよQC検定~
bunnchinn3
0
190
El Clima de España. Tema 2 (PPT)
juanmartin2026
0
3.5k
エビデンスベースト英語教育入門:エビデンスは科学的知見(だけ)ではない,制度だ!
terasawat
0
220
Featured
See All Featured
A Tale of Four Properties
chriscoyier
163
24k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
290
Producing Creativity
orderedlist
PRO
348
41k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
66k
Building AI with AI
inesmontani
PRO
1
1.3k
Speed Design
sergeychernyshev
33
2.1k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
840
Designing for Performance
lara
611
70k
A Soul's Torment
seathinner
8
3.7k
YesSQL, Process and Tooling at Scale
rocio
174
15k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
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);