idastan97

CSCI151 L20 P1

Oct 16th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void stringCopy(char fromStr[], char toStr[]){
  4.     int i=0;
  5.     while (fromStr[i]!='\0'){
  6.         toStr[i]=fromStr[i];
  7.         i++;
  8.     }
  9.     toStr[i]='\0';
  10. }
  11.  
  12. int main(void) {
  13.     char s1[30]="QWERTY";
  14.     char s2[50];
  15.     stringCopy(s1, s2);
  16.     printf("%s", s2);
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment