Created
May 28, 2012 05:35
-
-
Save MastodonHQ/2817466 to your computer and use it in GitHub Desktop.
Some of my early work quite a feat considering I was a novice then
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
#include <stdio.h> | |
/* | |
This Program prints an array dynamically without knowing the number of indices, and makes use of function pointers. Of course any programmer will tell you there is next to no need to ever do this and that you should know the size of the array at the time of declaration. | |
*/ | |
void list(char * array[], int indices){ | |
int x=0; | |
for(;x!=indices;x++){ | |
printf("%s",array[x]); | |
} | |
} | |
int main(){ | |
char * array[] = {"Hello World\n","This is a array test\n"}; | |
int i = sizeof(array) / sizeof(array[0]); | |
void (*lies)(char**,int); | |
lies = &list; | |
lies(array,i); | |
getchar(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment