box-o-sand/lcthw/ex14.c
2024-04-19 21:22:10 -04:00

37 lines
539 B
C

#include <stdio.h>
#include <ctype.h>
#include <string.h>
// forward declarations
void print_letters(size_t len, char arg[]);
void print_arguments(int argc, char *argv[])
{
int i = 0;
for (i = 0; i < argc; i++) {
print_letters(strlen(argv[i]), argv[i]);
}
}
void print_letters(size_t len, char arg[])
{
int i = 0;
for (i = 0; i < len; i++) {
char ch = arg[i];
if (isprint((int)ch)) {
printf("'%c' == %d ", ch, ch);
}
}
printf("\n");
}
int main(int argc, char *argv[])
{
print_arguments(argc, argv);
return 0;
}