Created
May 16, 2014 02:21
-
-
Save xnuk/fd31e2703e74d233b8af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <math.h> | |
| #include <stdlib.h> | |
| #include <time.h> | |
| #include "defines.h" | |
| void forEach(pint a,int size); | |
| void sth(pint d); | |
| void pri(pint d); | |
| int main noparam { | |
| int a[]={0, 3, 2, 7}; | |
| forEach(a, 4, sth); | |
| forEach(a, 4, pri); | |
| return 0; | |
| } | |
| void forEach(pint a,int length, pvoid func(int index, pint)){ | |
| register int i=0; | |
| for(; i<length; i++){ | |
| func(i, a+i); | |
| } | |
| } | |
| void sth(int i, pint d){ | |
| (*d)++; | |
| } | |
| void pri(int i, pint d){ | |
| printf("%d", *d); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment