J
Jeong-Gun Lee
I'm writing a code of writing a value to a specific memory address.
=================================================================
#include <stdio.h>
int main()
{
long air;
long *air_address;
printf("Air : %d, Air_address : %p\n", air, air_address);
(long *) air = air_address;
* (long *) air = 1211;
printf("Air : %d\n", * (long *) air);
/* Direct Memory Access to MEM[ 0x40009ca0 ] */
* (long *) 0x40009ca0 = 10;
printf("Direct MEM[0x40009ca0] = %d \n", * (long *) 0x40009ca0);
}
=================================================================
It was complied without any errors, but causes a run-time segmentation
error.
Is there anyone who tell the reason of why ?
and how to assign a value to a specific memory address ?
My test machine is a pentium processor and OS is a linux.
Thanks...
--
=================================================================
#include <stdio.h>
int main()
{
long air;
long *air_address;
printf("Air : %d, Air_address : %p\n", air, air_address);
(long *) air = air_address;
* (long *) air = 1211;
printf("Air : %d\n", * (long *) air);
/* Direct Memory Access to MEM[ 0x40009ca0 ] */
* (long *) 0x40009ca0 = 10;
printf("Direct MEM[0x40009ca0] = %d \n", * (long *) 0x40009ca0);
}
=================================================================
It was complied without any errors, but causes a run-time segmentation
error.
Is there anyone who tell the reason of why ?
and how to assign a value to a specific memory address ?
My test machine is a pentium processor and OS is a linux.
Thanks...
--