My Code:-
#include<stdio.h>
struct Demo{
int value;
};
int main(){
struct Demo *l;
l->value=4;
}
Getting Segmentation fault (core dumped)
because L object doesn't point something. use this :
#include <iostream>
using namespace std;
struct Demo
{
int val;
};
int main()
{
Demo* a = new Demo();
a->val = 10;
cout<<a->val;
}