Where does character pointer resides in memory, ROM or RAM?
My question is that why compiler is putting char *temp into ROM section?


It's not. If you don't believe me, try this temp = NULL;. That will execute just fine, proving that temp was stored in RAM, not ROM. Because temp is a variable, you are free to change its value.

What was stored in ROM was "", an empty string. Since the value of "" can't change, just as the value of 3 can't change, it makes sense to store it in ROM.

So what's wrong with:

itoa(some_integer, temp, 10);


At this point, temp points to the string literal "". You are trying to change the thing temp points to. But literals are constants, and temp points to a constant. So you are trying to change a constant. But you can't change a constant -- that's what makes it constant.

So, temp is a variable, and you can change its value. But it points to a constant. So you can't change the value of the thing it points to.