Advertisement
Guest User

Untitled

a guest
Nov 9th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include "function.h"
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. char ReadTwoCharElementsFunction(char* Element1, char* Element2)
  6. {
  7.     *Element1 = getchar(); getchar();
  8.     *Element2 = getchar(); getchar();
  9. }
  10.  
  11. char ReadStringFunction(char a, char b, char* szString)
  12. {
  13.     char* p = szString;
  14.  
  15.     while ((*p = getchar()) != '\n')
  16.     {
  17.  
  18.         if (*p == 'a') *p = b;
  19.         ++p;
  20.     }
  21.     *p = '\0';
  22.  
  23.     while (*p != '\0')
  24.     {
  25.         putchar(*p);
  26.         ++p;
  27.     }
  28.    
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement