Created
March 9, 2016 13:02
-
-
Save descilla/be004e2c42f9ab8a81cb to your computer and use it in GitHub Desktop.
This file contains 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
/* | |
============================================================================ | |
Name : map_algo.c | |
Author : S. Wüllhorst | |
Version : | |
Copyright : foo bar | |
Description : Hello World in C, Ansi-style | |
============================================================================ | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
typedef void* X; | |
typedef void* Y; | |
void map(unsigned int n, X x, size_t sizeof_X, Y y, size_t sizeof_Y, void (*f)(X, Y)); | |
void map(unsigned int n, X x, size_t sizeof_X, Y y, size_t sizeof_Y, void (*f)(X, Y)){ | |
//initialize required variables | |
int i = 0; | |
//simple precheck | |
if(n == 0 || x == NULL || sizeof_X == 0 || y == NULL || sizeof_Y == 0|| f == NULL) | |
return; | |
//iterate over map array | |
for(;i < n;){ | |
f(x,y); | |
x += sizeof_X; | |
y += sizeof_Y; | |
++i; | |
} | |
} | |
int main(void) { | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment