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
ОПК, семинар №8
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Ilya
March 12, 2015
Education
55
0
Share
ОПК, семинар №8
Указатели на функции
Ilya
March 12, 2015
More Decks by Ilya
See All by Ilya
Программирование на ЯВУ, семинар 3
ilya
0
160
Программирование на ЯВУ, семинар 2
ilya
0
73
ОПК, семинар №6
ilya
0
75
ОПК, семинар №4
ilya
0
110
ОПК, семинар №2
ilya
0
89
Other Decks in Education
See All in Education
ブランチ操作 / 02-a-branch
kaityo256
PRO
0
220
Adobe Express
matleenalaakso
2
8.2k
0203
cbtlibrary
0
150
Fulbright DAI 2025 學人經驗分享
joannie
0
110
Multimodal Interaction - Lecture 3 - Next Generation User Interfaces (4018166FNR)
signer
PRO
0
2.1k
タイムマシンのつくりかた
nomizone
3
1.2k
演習:GitHubの基本操作 / 06-github-basic
kaityo256
PRO
0
240
Highest and Best Use: Development Considerations for Land Sites
rmccaic
0
170
小さなまちで始める デジタル創作の居場所〜すべての子どもが創造的に未来を描ける社会へ〜
codeforeveryone
0
300
Introduction - Lecture 1 - Next Generation User Interfaces (4018166FNR)
signer
PRO
2
4.6k
良い塩梅を実現する、AWSネットワーク3分クッキング
masakiokuda
1
200
Leveraging LLMs for student feedback in introductory data science courses (Stats Up AI)
minecr
1
240
Featured
See All Featured
The Mindset for Success: Future Career Progression
greggifford
PRO
0
290
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.5k
Mobile First: as difficult as doing things right
swwweet
225
10k
SEO for Brand Visibility & Recognition
aleyda
0
4.4k
How Software Deployment tools have changed in the past 20 years
geshan
0
33k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
140
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
990
A designer walks into a library…
pauljervisheath
210
24k
The Cost Of JavaScript in 2023
addyosmani
55
9.8k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
300
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);