Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. char* tulloc(size_t size)
  5. {
  6.     int bytes_to_alloc = size*(sizeof("tull"));
  7.     char* p = malloc(bytes_to_alloc);
  8.    
  9.     int i=0;
  10.     for(i;i<bytes_to_alloc;i+=4){
  11.         p[i] = "tull";
  12.     }
  13.    
  14.     p[bytes_to_alloc] = '\0';
  15.    
  16.     return p;
  17.    
  18. }
  19.  
  20. int main()
  21. {
  22.     char *tull = tulloc(10);
  23.    
  24.     printf("%s\n",tull);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement