Created
February 12, 2018 08:56
-
-
Save 2jiwon/9d1190ad5f6cc18b004904a185d94695 to your computer and use it in GitHub Desktop.
Take command-line arguments and make them reverse output
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> | |
int | |
main (int argc, | |
char* argv[]) | |
{ | |
int num; | |
if (argc >= 1) | |
num = argc; | |
char* stack[num]; | |
char** sp = NULL; | |
int i; | |
for (i = 0; i < num; i++) | |
{ | |
stack[i] = argv[i]; | |
} | |
i--; | |
while (num--) | |
{ | |
sp = &(stack[i]); | |
printf ("argument %d: %p %s\n", i, *sp, *sp); | |
i--; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment