Code question

1
2
3
4
5
6
7
8
cout << "check1:" << fsdbtapdecoder->_num_tap_state <<endl;
	cout << "check2:" << fsdbtapdecoder->_max_tap_state <<endl;
        char *tap_state_rtl[fsdbtapdecoder->_num_tap_state + 1]
        cout << "check3:"<<endl;
for(int t = 0; t < fsdbtapdecoder->_num_tap_state; t++)
	{
		cout << "IN" <<endl;
}



check1:1860327
check2:1860608
then happen segmentation fault 



The program cant print check3 .May I know what is the problem. shoud be the problem at the array size?


do anyone know what is the problem here?
Last edited on
comment out that line char *tap_state_rtl[fsdbtapdecoder->_num_tap_state + 1]. If the problem is there, it is likely that you are out of bounds on the array index.
Ya.i commented out and check3 can be printed.so how can i solve the array out of bounds problem?
what are you trying to do with the line
char *tap_state_rtl[fsdbtapdecoder->_num_tap_state + 1] ?
firstly, it does not have a semicolon at the end.
secondly i guess you are declaring an array of pointers to char type. The size of the array seems to be variable type whereas it should be a constant.
Topic archived. No new replies allowed.