简体   繁体   中英

Segmentation faults in DAG Program

struct da 
{
int ptr,left,right;
char label;
}dag[25];

int ptr,l,j,change,n=0,i=0,state=1,x,y,k;

char store,*input1,input[25],var;

l=strlen(input1); //i'm Getting Segmentaion Fault here

The Complete Program is here http://bmohanrajcse.blogspot.com/2018/01/9-construction-of-dag.html

I didn't Know where & what to correct,Please help

input is uninitialized. strlen(NULL) will segfault. Try this:

char *input = "";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM