this will help you a little bit.

Code:
//This program prints the initialize value and the addresses of  the
//elements inside the array. This proram also allows the user to change
//the address of the hardcoded number in the program.

#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>

#define ARRAY_SIZE 4

int main(){
    //Declare variable
    int x=1,rep;
    char error[128];
    // Declare array
    int arr[]={1,2,3,4};
    //Declare pointer
    int *ptr;
      char hexAddress[10];
      long int address;
      int newValue=0;
    system("cls");
    //Show value of array elements
    printf("The value of elements inside the array:\n\n");
    for(int i=0;i<ARRAY_SIZE;i++){
            printf("Value of element %d: %d\n",i,arr[i]);
    }
    //Print addresses of array elements
    printf("The addresses of elements inside the array:\n\n");
    for(int i=0;i<ARRAY_SIZE;i++){
    ptr = &arr[i];
        printf("Address of element %d: %p\n",i,ptr);

    }
    printf("\ngive address:");
    fgets(hexAddress,10,stdin);
    address = strtol (hexAddress,NULL,16);
    ptr=(int *)(address);
    printf("value of element at address=%p is =%d\n",ptr,*ptr);
    printf("\ngive new value:");
    scanf("%d",&newValue);
    *ptr=newValue;
    printf("value of element at address=%p is =%d\n",ptr,*ptr);
    for(int i=0;i<ARRAY_SIZE;i++){
            printf("Value of element %d: %d\n",i,arr[i]);
    }
    getchar();    getchar();
return 0;
}

Last edited by virxen; 19Feb2010 at 23:38..