Last active
December 18, 2015 01:39
-
-
Save marawannwh/5705517 to your computer and use it in GitHub Desktop.
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> | |
#include <ctype.h> | |
// forward declarations | |
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; | |
} |
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" | |
#include "ctype.h" | |
int main(int argc, char *argv[]) | |
{ | |
int i = 0; | |
for(i = 0; i < argc; i++){ | |
int j = 0; | |
for(j = 0; argv[i][j] != '\0'; j++){ | |
if (isalpha(argv[i][j]) || isblank(argv[i][j])) | |
{ | |
printf("%c == %d \n", argv[i][j], argv[i][j]); | |
} | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment