I have initialized a Structure through a Pointer and I have tried to get values using Pointer too. I am getting Segmentation Fault. Any Clue on it?
#include <stdio.h>
#include <stdlib.h>
int main(void){
struct MemData{
char* FileName;
int LastByteLength;
int ReadPointer;
int WritePointer;
char Data[ 512000];//MEMORY BLOCK SIZE: 500 KB
};
struct MemData* M;
M->FileName=(char*)"xaa";
M->LastByteLength=0;
M->ReadPointer=-1;
M->WritePointer=-1;
printf("\n%s", M->FileName);
printf("\n%d", M->LastByteLength);
printf("\n%d", M->ReadPointer);
printf("\n%d", M->WritePointer);
}