box-o-sand/lcthw-remnants-2/ex29/src/ex29.c

44 lines
521 B
C
Raw Normal View History

2016-04-16 19:35:47 +00:00
#include <stdio.h>
#include <ctype.h>
#include "dbg.h"
int print_a_message(const char *msg)
{
printf("A STRING: %s\n", msg);
return 0;
}
2016-04-16 20:00:17 +00:00
int uppercase(const char *msg, int count)
2016-04-16 19:35:47 +00:00
{
int i = 0;
2016-04-16 20:00:17 +00:00
for(i = 0; i < count; i++) {
2016-04-16 19:35:47 +00:00
printf("%c", toupper(msg[i]));
}
printf("\n");
return 0;
}
2016-04-16 20:00:17 +00:00
int lowercase(const char *msg, int count)
2016-04-16 19:35:47 +00:00
{
int i = 0;
2016-04-16 20:00:17 +00:00
for(i = 0; i < count; i++) {
2016-04-16 19:35:47 +00:00
printf("%c", tolower(msg[i]));
}
printf("\n");
return 0;
}
int fail_on_purpose(const char *msg)
{
return 1;
}