summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2013-10-02 16:09:14 +0100
committerTom Hacohen <tom@stosb.com>2013-10-02 16:09:14 +0100
commit12f964c4855dd3eb85b4612ba23f1476cc954537 (patch)
tree38c8c64712f89877e72b183de206bef36affc81d
parent9f56f6a31762df8ae7f26e2481ea0032e1e90450 (diff)
Move the argument printing to a different function.HEADmaster
-rw-r--r--main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/main.c b/main.c
index ca54bc4..0584572 100644
--- a/main.c
+++ b/main.c
@@ -1,6 +1,12 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <stdlib.h> 2#include <stdlib.h>
3 3
4static void
5print_arg(char *argv[], int argument)
6{
7 printf("arg %d: %s\n", argument, argv[argument]);
8}
9
4int 10int
5main(int argc, char *argv[]) 11main(int argc, char *argv[])
6{ 12{
@@ -10,7 +16,7 @@ main(int argc, char *argv[])
10 argument = atoi(argv[1]) - 1; 16 argument = atoi(argv[1]) - 1;
11 17
12 if (argument < (unsigned) argc) 18 if (argument < (unsigned) argc)
13 printf("arg %d: %s\n", argument, argv[argument]); 19 print_arg(argv, argument);
14 else 20 else
15 return 1; 21 return 1;
16 22