Reputation: 3149
I make a DFA Simulator.
if Node 0 is initial state and Node 3 is final state, like weight graph implementation.
char CurrentStateAccept[stateN][alphabetN][alphabetN] = { {"01"} , {"0"} , {"0","1"} ,{} }; // 0, 1, 2, 3
int NextState[stateN][alphabetN] = {{1},{2},{0,3},{}};
I want to get 1, 1, 2, 0
so I want to get char CurrentStateAccept[each state]'s element number for using 'for loop' ex)
for(i=0; i<currentState element num; i++)
{
for(j=0; j<end of alphabet of each element; j++)
{
there is acceptable state? or not?
}
}
How can I get in C?
Upvotes: 2
Views: 125
Reputation: 57312
you mean something like this
sizeof(array)/sizeof(type of array);
Upvotes: 3