Previous      Next

//  Bad Mistake!!
//  Returns the right answer but...

int *threeMultiply (int n)
{
   int r;
   r = (3*n);
   return &r;
}

void main ()
{
   int *x;
   
   x = threeMultiply (9);
   printf("\nValue of 9*3: %d\n", *x);
}

// Sample Output:
//   Value of 9*3: 27