some-usable-scripts/c/old/minuscule.c

26 lines
440 B
C
Raw Normal View History

2011-10-27 18:22:48 +02:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// met en minuscule la chaîne
void minuscule(char *);
int main(int argc, char * argv[])
{
if(argc < 2)
{
printf("Usage : %s SenTeNCe\n",argv[0]);
exit(EXIT_FAILURE);
}
char * s = malloc(sizeof(char) * strlen(argv[1]));
s = strcpy(s,argv[1]);
minuscule(s);
printf("%s\n", s);
return EXIT_SUCCESS;
}
void minuscule(char * s)
{
while(*s++ && (*s = tolower(*s)));
}