fork download
  1. #include <stdio.h>
  2. #include <cs50.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6. string filter(string);
  7.  
  8. char sum(char, char);
  9.  
  10. int main(void)
  11. {
  12. // Берем стринг
  13. string name = "32423423s asdasdasd 3dsads";
  14. // Фильтруем его
  15. string filtered = filter(name);
  16. // выводим отфильтованное
  17. printf("%s", filtered);
  18.  
  19. char first[] = "123";
  20. char second[] = "324234";
  21. sum(first, second);
  22.  
  23. return 0;
  24. }
  25.  
  26.  
  27. string filter(string c)
  28. {
  29. string filtered_string = "";
  30.  
  31. //counter step
  32. for (int i = 0, n = strlen(c); i < n; i++)
  33. {
  34. // в этом месте должно быть условие одупляющее буквы и пробелы
  35. if ((i >= 'A' && i <= 'Z') || (i >= 'a' && i <= 'z'))
  36. {
  37. //printf("%c Y", toupper(c[i]));
  38. // А тут вместо равно долно обьеденять строку
  39. }
  40. else
  41. {
  42. //printf("%c N", toupper(c[i]));
  43. }
  44. }
  45.  
  46. return filtered_string;
  47. }
  48. char sum(char a, char b)
  49. {
  50. char aa[] = a;
  51. char bb[] = b;
  52. strcat(aa, bb);
  53. return (char*) aa;
  54. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:21:9: warning: passing argument 1 of ‘sum’ makes integer from pointer without a cast [-Wint-conversion]
     sum(first, second);
         ^~~~~
prog.c:8:6: note: expected ‘char’ but argument is of type ‘char *’
 char sum(char, char);
      ^~~
prog.c:21:16: warning: passing argument 2 of ‘sum’ makes integer from pointer without a cast [-Wint-conversion]
     sum(first, second);
                ^~~~~~
prog.c:8:6: note: expected ‘char’ but argument is of type ‘char *’
 char sum(char, char);
      ^~~
prog.c: In function ‘sum’:
prog.c:50:17: error: invalid initializer
     char aa[] = a;
                 ^
prog.c:51:17: error: invalid initializer
     char bb[] = b;
                 ^
prog.c:53:12: warning: return makes integer from pointer without a cast [-Wint-conversion]
     return (char*) aa;
            ^~~~~~~~~~
prog.c:53:12: warning: function returns address of local variable [-Wreturn-local-addr]
stdout
Standard output is empty