Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ОПК, семинар №8
Search
Ilya
March 12, 2015
Education
0
55
ОПК, семинар №8
Указатели на функции
Ilya
March 12, 2015
Tweet
Share
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
88
Other Decks in Education
See All in Education
✅ レポート採点基準 / How Your Reports Are Assessed
yasslab
PRO
0
150
AIを使って最新研究 について調べて発表しよ う!
mickey_kubo
4
170
JavaScript - Lecture 6 - Web Technologies (1019888BNR)
signer
PRO
0
3.1k
仏教の源流からの奈良県中南和_奈良まほろば館‗飛鳥・藤原DAO/asuka-fujiwara_Saraswati
tkimura12
0
170
XML and Related Technologies - Lecture 7 - Web Technologies (1019888BNR)
signer
PRO
0
3.1k
HCI Research Methods - Lecture 7 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.2k
【ZEPメタバース校舎操作ガイド】
ainischool
0
690
1014
cbtlibrary
0
500
Semantic Web and Web 3.0 - Lecture 9 - Web Technologies (1019888BNR)
signer
PRO
2
3.1k
アジャイルの知見から新卒研修作り、そして組織作り
pokotyamu
0
120
Web Architectures - Lecture 2 - Web Technologies (1019888BNR)
signer
PRO
0
3.3k
あなたの言葉に力を与える、演繹的なアプローチ
logica0419
1
240
Featured
See All Featured
Discover your Explorer Soul
emna__ayadi
2
1k
Crafting Experiences
bethany
0
19
30 Presentation Tips
portentint
PRO
1
160
Building an army of robots
kneath
306
46k
Become a Pro
speakerdeck
PRO
31
5.7k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
250
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
250
Being A Developer After 40
akosma
91
590k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
120
The untapped power of vector embeddings
frankvandijk
1
1.5k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.3k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
220
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);