SHARE
TWEET

Untitled

a guest Feb 17th, 2017 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int* f()
  4. {
  5.     int a[4] = {21, 22, 23, 24};
  6.     return &a[0];
  7. }
  8.  
  9. int main()
  10. {
  11.     int *p = f();
  12.     printf("%d %d %d %d\n", p[0], p[1], p[2], p[3]);
  13.     int a[4] = {1, 2, 3, 4};
  14.     printf("%d %d %d %d\n", p[0], p[1], p[2], p[3]);
  15.     return 0;
  16. }
RAW Paste Data
Top