Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 3rd, 2012  |  syntax: None  |  size: 0.29 KB  |  hits: 14  |  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 <cstring>
  2. #include <cstdlib>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     char *name;
  8.     name = (char *) malloc(100); /* allocate 100 byte buffer */
  9.     strcpy(name, "hello"); /* copy the bytes of "hello" into the buffer */
  10.     free(name); /* free the buffer */
  11.     return 0;
  12. }