Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //main.c
- #include<stdio.h>
- #include<string.h>
- void replace_space(char *s, char c);
- int main(){
- int i=0,len =0;
- char s[100],ch;
- gets(s); fflush(stdin);
- // printf("%s\n",s);
- // scanf("%s",&s[0]); fflush(stdin);
- // printf("%s\n",s);
- scanf("%c",&ch);
- // printf("%c\n",ch);
- len = strlen(s);
- while(i<len){
- if(s[i]==' '){
- replace_space(&s[i],ch);
- }
- i++;
- }
- printf("%s",s);
- return 0;
- }
- void replace_space(char *s, char c){
- *s = c ;
- }
Advertisement
Add Comment
Please, Sign In to add comment