Help for this page

Select Code to Download


  1. or download this
    int *mysub ();
    main() {
    ...
        z = 3;
        return &z;
    }
    
  2. or download this
    $ make temp
    gcc     temp.c   -o temp
    temp.c: In function `mysub':
    temp.c:13: warning: function returns address of local variable
    
  3. or download this
    $ temp
    in sub z = 0
    in main x = 3
    in sub z = 5
    
  4. or download this
    use strict;
    my $x;
    ...
        return \$z;
    }
    
  5. or download this
    $ perl temp.pl
    in sub $z = 0
    in main $x = 3
    in sub $z = 0
    
  6. or download this
    int *mysub () {
        static int z;
    ...