After doing lot of research in Google, I found below program
Google
#include int main() { int val; char *a = (char*) 0x1000;
First you need to be sure about memory location where you want to write into. Then, check if you have enough permission to write or not.