Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- char* stack[10];
- void push(char foo[]) {
- int counter;
- for (counter = 0; counter < sizeof(stack); counter++) {
- if (stack[counter] != NULL) {
- strcpy(stack[counter], foo);
- break;
- }
- }
- }
- int main(int argc, const char *argv[]) {
- int i;
- for (i = 0; i < 10; i++) stack[i] = malloc(20 * sizeof(char));
- for (i=1; i < argc; i++) push(argv[i]);
- printf("%s\n",stack[0]);
- printf("%s\n",stack[1]);
- printf("%s\n",stack[2]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement