Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- /* argv[0] = Execution.. so it acutally is the executable file .. not a paramter so we need to add 1 to the params
- argc with a value of 1 = the execution.. so argc 1 = argv[0] */
- int main(int argc, char * argv[])
- {
- char *value;
- int i;
- int j;
- int m;
- for(i=1; i<argc; i++)
- {
- value = argv[i];
- j = i -1;
- do
- {
- argv[j + 1] = argv[j];
- j = j-1;
- } while(j >= 0 && argv[j] > value);
- argv[j+1] = value;
- }
- for(m=1; m < argc; m++)
- {
- printf("%s\n", argv[m]);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment