Skip to content

Instantly share code, notes, and snippets.

@descilla
Created March 9, 2016 13:02
Show Gist options
  • Save descilla/be004e2c42f9ab8a81cb to your computer and use it in GitHub Desktop.
Save descilla/be004e2c42f9ab8a81cb to your computer and use it in GitHub Desktop.
/*
============================================================================
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