I having a nested structures which are referenced with pointer variables
please help me as soon as possible
Code:
#include <stdio.h>
struct test
{
int i;
char *mytest;
};
struct sample
{
int k;
struct test *test1;
};
int main()
{
struct sample *mysample;
printf("Inside main method \n\n");
mysample->k=0;
mysample->test1->i=1; // It's throws segmentation fault error at this point how to access this variable.
printf("the value of the k is %d \n\n",mysample->k);
// printf("the value of the k is %d \n\n",mysample->test->i);
return 0;
}
Comment