Previous      Next

//  Much Better Now!!!!

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

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

// Sample Output:
//   Value of 9*3: 27, 10*3: 30