Advertisement
Guest User

Untitled

a guest
Nov 20th, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include <stdio.h>;
  2. #include <stdlib.h>;
  3. char* replace(char *s, char c1, char c2)
  4. {
  5.     int i;
  6.     for (i=0; i<10; i++)
  7.     {
  8.         if (s[i]==c1) s[i]=c2;
  9.     }
  10.     return s;
  11. }
  12.  
  13. int main()
  14. {
  15.     int i;
  16.     char c1='a',c2='b';
  17.     char *pole=(char*)malloc(10*sizeof(char));
  18.     for (i=0; i<10; i++) pole[i]='a';
  19.     pole=replace(pole, c1, c2);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement