Apply a callback to an array: Difference between revisions

m
→‎{{header|C}}: - ww (nothing special, it's C) ; desectioned
(added Ursala)
m (→‎{{header|C}}: - ww (nothing special, it's C) ; desectioned)
Line 116:
=={{header|C}}==
 
==='''callback.h==='''
{{works with|gcc|4.1.1}}
<lang c>#ifndef CALLBACK_H
{{works with|TCC|0.9.23}}
{{works with|ICC|9.1}}
===callback.h===
<lang c>
#ifndef CALLBACK_H
#define CALLBACK_H
 
Line 136 ⟶ 132:
void map(int* array, int len, void(*callback)(int,int));
 
#endif</lang>
</lang>
 
==='''callback.c==='''
<lang c>#include <stdio.h>
#include <stdio.h>
#include "callback.h"
 
Line 167 ⟶ 161:
map(array, 4, callbackFunction);
return 0;
}</lang c>
}
</lang>
 
==='''Output==='''
 
array[0] = 1