Write a code snippet to declare and accept an integer and calculate the cube value of the integer. The integer should be passed by reference to a function cube(). The function would calculate the result of cubing the integer.
The function prototype to be used is: void cube (int *p);
Sample input-output
Please enter an integer: 2
The cube of integer 2 is 8