I got the seg fault in here. I confused. Please help me out. f1 and y are both pointer for struct node. I want to turn y's left to f1 right.
#include <stdio.h>
#include <stdlib.h>
struct node{
int data;
struct node* left;
struct node* right;
};
int main(){
struct node* f1=(struct node *)malloc(sizeof(struct node));
struct node* y=(struct node *)malloc(sizeof(struct node));
f1->data=10;
y=f1->right;
f1->right=y->left; //seg fault is in this line.
return 0;
}`