code_junkie

How to release the memory that has been used for a variable in C?

Nov 11th, 2011
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. for (int i=0;i<10;i++) {
  2. int k=i;
  3. //do stuff
  4. }
  5.  
  6. int* intArray;
  7. malloc(200 * sizeof(int));
  8.  
  9. char array[100];
  10.  
  11. int reallylongfunction() {
  12. // Do a lot of stuff
  13. {
  14. char stringbuffer[100];
  15. // Do stuff with the buffer...
  16. // Ok, we're done with the buffer, and don't want it anymore
  17. }
  18. // Do a lot more stuff
  19. return;
  20. }
Add Comment
Please, Sign In to add comment