0

```
#include<stdio.h>
#include<string.h>
/*#include<stack.h>*/
#define MAX 10000
#define TRUE 1
/*typedef struct node node
struct node
{ int */
int graph[MAX][MAX]; /* = { { 0, 1 },/* 0 1 0 */
/*{ 1, 1 }};2 0 0; */int nodes;
int fnodes;
int counter2 = 0;
int counter = 0;//Start states
int myStack;
int start[MAX];
int final[MAX];int V, E;
int visit[MAX];
char states[5];
bool empty = TRUE;
int read()
{
nodes = -1;
memset(states,0, sizeof(states));
scanf("%d" ,&nodes);
if (nodes <0)
{
return 0;
}
/*if(nodes == 0) */
/*return 0; */
scanf(*"%d ", &fnodes);
counter = 0;/*Start States*/
counter2 = 0;/*Final States*/
int cont;/*String Length*/
for(int a=0; a<fnodes; a++)
{
scanf("%d ",states);
cont = -1;
for(int k=0; k<5; k++)
if(states[k] != '\0')
cont++;
else
break;
/*printf("cont -> " , cont);
printf(" %d ", *states);
printf("%d ", states[0]);
printf(" %d ", states[cont]); */
int aux = 0;/*Sum of characters for Nodes */
int aux2 = 0;/*Sum of characters for Nodes*/
int mult = 1;/*Multiple */
if(states[cont]=='f')
{
for(int k=cont-1; k>=0; k--)
{
/*printf(" -> %d " , states[k]); */
aux+=((int)states[k]- 48)*mult;
/*printf(" -> %d " ,aux); */
mult*=10;
}
final[counter2++] = aux;
/*prinf(" %d ", final[counter2-1]);*/
}
else
{
for(int k=cont-1; k>=0; k--)
{
/*printf(" -> %d", states[k]);*/
aux+=((int)states[k]-48)*mult;
mult*=10;
}
start[counter++] = aux;
}
/*printf(" %d ",start[counter-1]);
//printf(" %d " ,counter ); */
}
for(int a=0; a<nodes; a++)
{
for(int b=0; b<nodes; b++)
{
scanf(" %d %d " ,graph[a][b]);
}
}
if(counter>1)
return -1;
return 1;
}
void calc()
{
for(int a=0;a<30;a++)
{
for(int b=0;b<30;b++)
{
if(a*b<100)
graph[a][b]=0;
else
graph[a][b]=1;
}
}
}
bool compareVertex(int v)
{
for(int k=0; k<counter2; k++)
if(final[k]==v)
{
/*printf(" %d , %d " ,final[k],v);*/
return true;
}
return false;
}
void dfs(int vertex)
{
/*printf(" %d ",vertex);*/
if(compareVertex(vertex))
empty=false;
visit[vertex] = 1;
for (int i=0;i<nodes;i++)
if (!visit[i] && graph[vertex][i])
dfs(i);
}
void bfs(int s)
{
int i, j, node;
memset(visit, 0, sizeof(visit));
myStack.push(s);
while(!myStack.empty())
{
node = myStack.top();
myStack.pop();
if(visit[node]) continue;
visit[node] = 1;
for(i=0; i<V; i++)
if(graph[node][i]) myStack.push(i);
}
}
void print()
{
for(int a=0;a<nodes;a++)
{
for(int b=0;b<nodes;b++)
{
printf(" %d ",graph[a][b]);
}
}
}
int main()
{
int j=0;
int locuas = -1;
/*calc();*/
do
{
locuas = read();//Check integer
/*if(locuas == -1)
{
printf("This is not an DFA");
continue;
}*/
if(locuas == 0)
return 0;
/*print();*/
for (int i=0;i<nodes;i++)
visit[i] = 0;
for(int h=0; h<counter;h++)
dfs(start[h]);
if(empty)
printf("The Automata Language is Empty");
else
printf("The Automata Language is not Empty");
empty = true;
/*bfs(0);*/
}while(true);
return 0;
}
```

/////////////////////////////

error

L.12: array size too large

L.19: too much global data define in the file