BUT2/DEV/DEV1.1/TP_ChainesDeCaracteres/#q3.c#

29 lines
643 B
Plaintext
Raw Permalink Normal View History

2023-10-23 13:23:36 +02:00
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
char premiereLettre(char chaine[10]){
int emplacement=0;
int tailleArg;
char caractere=chaine[emplacement];
tailleArg=strlen(chaine);
for (;((caractere<65)||((caractere>90)&&(caractere<97))||(caractere>122))&&(emplacement<=tailleArg); emplacement++){
if (emplacement==tailleArg){
return '\0';
}
caractere=chaine[emplacement];
}
return caractere;
}
int main(int argc, char** argv) {
int argument;
char lettre;
for (argument=1;argument<=argc;argument++){
lettre = premiereLettre(argv[argument]);
printf("%c",lettre);
}
printf("/n");
return EXIT_SUCCESS;
}