









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










int foo( ){
} int main (int argc, char* argv[]) {
foo() ; ……
main
foo
main:.LFB6:
pushq
%rbp
.LCFI2:
movq
%rsp, %rbp
.LCFI3:
subq
$32, %rsp
.LCFI4:
movl
%edi, -20(%rbp)
movq
%rsi, -32(%rbp)
movl
$10, -4(%rbp)
movl
-4(%rbp), %edi
call
foo
leaveret
Assembly code
Functions that return function pointers
typedef int (*Ptr)(int,int);
An array of char *’s
guna
andy
me
Write the compare function to sort by alpha orderInt (*strcomp)(const void * a, const void * b))
Guna
Andy
Me
Write the compare function to sort by name:int (*nodecomp)(const void * a, const void * b))
Generic Bubble sort with
function pointers
typedef int (cmp)(const void, int , int);typedef int (swap)(void, int, int); int bubblesort(void* A, int n, cmp cfn, swap sfn){