Skip to content

Instantly share code, notes, and snippets.

@pr4v33n
Created March 13, 2011 15:22
Show Gist options
  • Save pr4v33n/868169 to your computer and use it in GitHub Desktop.
Save pr4v33n/868169 to your computer and use it in GitHub Desktop.
crazyman
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char **zoznam;
zoznam = (char**)malloc(10*sizeof(char*));
int i;
for (i = 0; i < 10; i++)
{
zoznam[i] = (char*)malloc(10 * sizeof(char));
}
strcpy(zoznam[0], "start");
strcpy(zoznam[1], "end");
strcpy(zoznam[2], "stupid");
for(i=0;i<3;i++)
printf("%s\n",zoznam[i]);
for(i=0; i<10; ++i) {
free(zoznam[i]);
}
free(zoznam);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment