Hi guys, I'm new around here. I'm currently doing my internship, and work daily with C. My question is, why is code below crashing?
Code:
#include <stdio.h>
#include <stdlib.h>
struct bpf_insn {
short code;
char jt;
char jf;
int k;
};
struct bpf_program {
int en;
struct bpf_insn *bf_insn;
};
int main()
{
struct bpf_insn *bf_insn;
bf_insn->code =12;
bf_insn->jt =11;
bf_insn->jf =10;
bf_insn->k =9;
printf("bf_insn->jt is %d",bf_insn->jt);
struct bpf_program *program;
return 0;
}
The error apears when I make a pointer of type bpf_program.
a)why is this?
b)How can i fix this?
All what I want, is a pointer from type bpf_program, wich directs me to my counter and my pointer(wich point to the data)(this is the other struct)
Thanks,
Libpgeak