Skip to content

Commit

Permalink
ex14 initial
Browse files Browse the repository at this point in the history
  • Loading branch information
jessewmc committed Jul 28, 2014
1 parent b54ef2c commit 41d4dc9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CFLAGS=-Wall -g

all: ex1 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 ex11 ex12 ex13
all: ex1 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 ex11 ex12 ex13 ex14


clean:
Expand Down
Binary file modified ex13
Binary file not shown.
Binary file added ex14
Binary file not shown.
35 changes: 35 additions & 0 deletions ex14.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include <stdio.h>
#include <ctype.h>

//forward declarations, what?
int can_print_it(char ch);
void print_letters(char arg[]);

void print_arguments(int argc, char *argv[]){
int i = 0;

for(i = 0; i < argc; i++){
print_letters(argv[i]);
}
}

void print_letters(char arg[]){
int i = 0;
for(i=0; arg[i] != '\0'; i++){
char ch = arg[i];
if(can_print_it(ch)){
printf("'%c' == %d ", ch, ch);
}
}
printf("\n");
}

int can_print_it(char ch)
{
return isalpha(ch) || isblank(ch);
}

int main(int argc, char* argv[]){
print_arguments(argc, argv);
return 0;
}

0 comments on commit 41d4dc9

Please sign in to comment.