daily pastebin goal
30%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int  cLen     = 8    /* Specified Length    */
  2. char chr      = "a"; /* Specified Character */
  3. char outStr[cLen];
  4. int  tmp      = 0;
  5. while (tmp < cLen-1) {
  6.   outStr[tmp] = chr;
  7.   tmp += 1;
  8. }
  9. outStr[cLen-1] = '';
  10.  
  11. /* outStr = "aaaaaaaa" */
  12.    
  13. char *str = malloc(cLen + 1);
  14. memset(str, 'a', cLen);
  15. str[cLen] = 0;
  16.    
  17. void repeated_string(char *out, size_t len, char v)
  18. {
  19.   for(; len > 0; --len)
  20.     *out++ = v;
  21.   *out = '';
  22. }
  23.    
  24. #include <stdlib.h>
  25.    
  26. char *cpString;
  27.    
  28. cpString=malloc(n*sizeof(char));
  29.    
  30. memset(cpString,X,n-1);
  31. cpString[n]=0;
  32.    
  33. if (cpString !=0)
  34. {
  35.  free(cpString);
  36.  cpString=0;
  37. }
  38. cpString=malloc(n*sizeof(char));
  39.    
  40. int cLen = 8; /* Specified Length */
  41.    
  42. int cLen = 9; /* Specified Length (8) + 1 for NULL */
  43.    
  44. char chr = "a";
  45.    
  46. char chr = 'a';
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top