I'd like to know what is the difference between RAM ( data memory ) and the stack memory in PIC micro controllers if both of them is volatile( not sure about stack ) and the stack is temporary memory?
All RAM memory requires a constant current to hold its state. That is, as soon as you turn the power off, all of your RAM memory vanishes. Thus, RAM is volatile.
The stack is a specific area of RAM memory used to store temporary variables during program execution. Each function call "pushes" data to the stack. The data is "popped" when the function returns. Because the stack is stored in RAM, it too is volatile.
When a subroutine is called, the processor pushes the return address on the stack, and may make space for local variables (this can very with processor and compiler). A processor register called the stack pointer contains the address of the next free location on the stack, and is decremented when something is pushed onto the stack, and incremented when something is removed from the stack.
The stack is usually placed at the top of RAM, and extends downward as items are pushed on it.
The stack is usually part of the volatile RAM memory space, but actual implementation may vary between microcontroller families.