Can stack be reversed using dynamic allocation?

I have implemented the code and the output is also correct but I am not sure if it is a right way to implement the reverse function. Please confirm.
Link: https://ide.codingblocks.com/s/110254

@ParvBudh
Ofcourse. It doesn’t matter how you create the stack , static allocation or dynamic , both work the same way. The reverse algo implementation is for stack and it doesn’t matter in any way how you created it.
Your implemetntation is correct and does not cause any problems.
Just wanted to point that even though it doesn’t really affect your program in any way whatsoever , there is no need to pass the stack s1 pointer as reference into the function.
You can remove the & sign from Line No. 6.
Although even if you don’t . it doesn’t matter as you are taking return into s1 pointer only.

Your implementation is fine and there’s no issue with it.