i am trying to implement a stack that keeps throwing an exception and says unable to read memory.
its working fine with int and even char when i tested them alone using push and pop functions but not in this loop case i don't know why
You use the word "exception" but your code doesn't use exceptions. The push function prints an error message but that is not the same thing as throwing an exception. Is that the problem? You want an exception to be thrown so that the loop is aborted?
i copied the same exact functional stack from my other project that's 100% working, yet it keeps hitting me with these exceptions in this project i don't know why