Advertisement
hamaXD

CPT lab04-02

Sep 12th, 2017
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. //main.c
  2. #include<stdio.h>
  3. #include<string.h>
  4.  
  5.  
  6. char* find_space(char *s);
  7. int main(){
  8.     int i=0,len =0;
  9.     char s[100],ch,copy[100],cc,*null=NULL;
  10.     gets(copy); fflush(stdin);
  11.     scanf("%c",&cc);
  12.     len = strlen(copy);
  13.     while(i<len){
  14.         printf("%c\n",copy[i]);
  15.         if(find_space(&copy[i]) != NULL){
  16.             copy[i] = cc;
  17.         }  
  18.         printf("%c\n",copy[i]);
  19.         i++;
  20.     }  
  21.     printf("\n");
  22.     printf(copy);
  23.  
  24.     return 0;
  25. }
  26.  
  27. char* find_space(char *s){
  28.     printf("in f = %c\n",*s);
  29.     char *null=NULL;
  30.     if(*s == ' ') {
  31.         printf("in if\n");
  32.         return s;
  33.     }else{
  34.         printf("in else\n");
  35.         return null;
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement