Here is the code :

```
//Program to store memory address in a file & retrieve it later
#include<stdio.h>
#include<stdlib.h>
typedef struct employee {
    int empId;
    struct employee *next;
}emp;

int main(int argc, char *argv[])
{
    emp *node = NULL;
    FILE *fp;
    if (atoi(argv[1])==1) {
        node = (emp *) malloc(sizeof(node));
        printf("Enter the employee Id: ");
        scanf("%d",&node->empId);
        node->next=NULL;
        printf("The value that was entered was: %d\n",node->empId);
        fp =  fopen("/home/userName/sampleAddress.txt","w");
        fprintf(fp,"%d",node);
        fclose(fp);
        node = NULL;
    }
    if (atoi(argv[1]) == 2) {
        fp = fopen("/home/userName/sampleAddress.txt","r");
        long address;
        fscanf(fp, "%d", &address);
        printf("address read: %d\n", address);
        memcpy(node, (const void *)address, sizeof(node));
        fclose(fp);
        printf("The empId is - %d\n",node->empId);
        free(node);
    }
    return 0;
}

```

I am trying to store the address of node in a file. The next time I run the code with an argument '2', node should point to the memory address stored in the file.
I get a segmentation fault. Is this even possible; if so, what am I doing wrong?