Adak I've been away from coding for awhile so i may be missing something, however your code doesn't compile. It may have something to do with how you called cube() and put it in the print statement. you should try and compile it.
Also calling the function from printf is a little redundant since cube() already calls it to ouput data to stdout. I'm also wondering why you included <stdlib.h> in the code, what function were you calling from there? I'm gonna go with you left it in as an oversight when the OP called system() which is a
NO NO in C and C++ programming. Along with
the return value of main. lol, good think salem didn't see that OP.
as well the requirements of the OP is to accept a double as argument so we kinda have to go along those guidelines. I've modified your program somewhat, its a nice way to solve the problem. of course we could make it more user friendly by having the user input the number to be cubed.;)
Code:
#include <stdio.h>
void cube(double *);
int main(void) {
double num = 3;
cube(&num);
printf("press enter to exit");
getchar();
return 0;
}
void cube(double *pnum) {
*pnum = (*pnum) * (*pnum) * (*pnum);
printf("pnum cubed is %.2lf \n", *pnum);
printf("The address of pnum is: %p\n", &pnum);
}