Advertisement
Manhydra

C Constructor/Destructor Example

Jan 25th, 2015
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. __attribute__((constructor)) void goFirst (void) {
  5.   puts("I go first!");
  6. }
  7.  
  8. __attribute__((destructor)) void goLast (void) {
  9.   puts("I go last!");
  10. }
  11.  
  12. int main(void) {
  13.   puts("I go whenever the system feels like it. I can haz no power :(");
  14.   return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement