Advertisement
horselurrver

Ch 11 Ex1

Aug 8th, 2016
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. char * arrays(char *string, int n);
  3. int main(void){
  4.     char *ptr2;
  5.     ptr2=arrays("voila", 5);
  6.     int i;
  7.     for(i=0; i<5; i++){
  8.         printf("%c", *(ptr2+i));
  9.     }
  10.     printf("\n");
  11.     return 0;
  12. }
  13.  
  14. char * arrays(char *string, int n){
  15.     char array2[80];
  16.     char *ptr2;
  17.     ptr2=array2;
  18.     int i;
  19.     for(i=0; i<n; i++){
  20.         *(ptr2+i)=string[i];
  21.     }
  22.     return ptr2;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement