Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 5th, 2012  |  syntax: C  |  size: 0.22 KB  |  views: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <stdio.h>
  2.  
  3. void freeStr(char **str) {
  4.     *str = NULL;
  5. }
  6. int main() {
  7.     char* str = (char *)"some string";
  8.     printf("Before: %s\n", str);
  9.     freeStr(&str);
  10.     printf("After: %s\n", str);
  11.     return 0;
  12. }
clone this paste RAW Paste Data