bonjour
j'ai essaye avec ce code d'enlever les espaces dans une chaine mais il ne fonctionne pas!!!!!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #include<stdio.h> #include <string.h> int main () { char h[30]; int nb,i,j; printf("donner une chaine de caractere n"); scanf("%s",h); nb=strlen(h); for(i=0;i<=nb;i++) { if(h[i]==' ') { for(j=i;j<=nb;j++) { h[j]=h[j+1]; } } } printf("le nouveau chaine %s",h); }
Partager