Professional Documents
Culture Documents
Task 4 in C
Task 4 in C
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
typedef struct {
int state;
bool epsilon;
int transitions[MAX_STATES];
int numTransitions;
} State;
// If the transition is an ε transition and the next state hasn't been visited
int main() {
int numStates;
State nfa[MAX_STATES];
nfa[i].state = i;
printf("Is State %d an epsilon state? (0 for no, 1 for yes): ", i);
scanf("%d", &nfa[i].epsilon);
scanf("%d", &nfa[i].numTransitions);
{ scanf("%d", &nfa[i].transitions[j]);
printf("\n");
int closure[MAX_STATES] = { 0 };
if (closure[j]) {
printf("\n");
return 0;
}