Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // student c/c++ name Naelson c/c++ advanced !
- // Date 2016/12/08
- #include <iostream>
- #include <stdlib.h>
- #include <string.h> // directory of strcpy;
- using namespace std;
- int main(){
- char *ptr;
- ptr = (char* )malloc(1); //allocated one bits of memory for pointer ptr.
- strcpy(ptr ,"GameOver");
- cout<<*ptr<<"\n"<<&ptr<<endl;
- realloc(ptr,8); //reallocating new size of memory.
- free(*ptr); //deallocated the memory
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement