Assuming that we have the code

Code:
int *p

*p = 2;
That is wrong and dangerous of course because pointer is uninitialized and it has no a known address.

Some books they write that p will modify the code data (program code) if p happens to have an address of program code of course.

I think this is not true on the linux because of

the memory layout of processes....

assuming this scheme ->

Linux Processes

the TEXT segment which has the code of the program is ROM . Hence we can't modify its contents even if p points to this area.