#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')

     /*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 */

          for(int k=cont-1; k>=0; k--)
           /*printf(" -> %d " , states[k]); */
            aux+=((int)states[k]- 48)*mult;
            /*printf(" -> %d " ,aux);  */

         final[counter2++] = aux;
         /*prinf(" %d ", final[counter2-1]);*/
          for(int k=cont-1; k>=0; k--)
            /*printf(" -> %d", states[k]);*/
         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]);
     return -1;
  return 1;
void calc()
 for(int a=0;a<30;a++)
     for(int b=0;b<30;b++)
bool compareVertex(int v)
    for(int k=0; k<counter2; k++)
          /*printf(" %d , %d " ,final[k],v);*/
          return true;
    return false;

void dfs(int vertex)
  /*printf(" %d ",vertex);*/

  visit[vertex] = 1;
  for (int i=0;i<nodes;i++)
    if (!visit[i] && graph[vertex][i])
void bfs(int s) 
     int i, j, node;
     memset(visit, 0, sizeof(visit));
          node = myStack.top();
          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;
 locuas = read();//Check integer
  /*if(locuas == -1)
     printf("This is not an DFA");
  if(locuas == 0)
     return 0;
  for (int i=0;i<nodes;i++)
      visit[i] = 0;
  for(int h=0; h<counter;h++)

      printf("The Automata Language is Empty");
      printf("The Automata Language is not Empty");
  empty = true;


 return 0;


L.12: array size too large
L.19: too much global data define in the file

Recommended Answers

All 4 Replies

There's a limit to how big your data structures can be.

Since MAX is 10,000 you are asking for an array of
10,000 x 10,000 x sizeof( int ) bytes
which is likely about 400,000,000 bytes, which is nearly a half a Gigabyte!

Either make a smaller array, or google "sparse arrays" and "sparse matrices" and "hash tables".

Good luck.

thanks, but since i convert this code from C++ to C can you tell how can i do it,

why do you need such huge arays? The calc function at line 97 only uses a 30x30 array.

What compiler are you using? From the errors you posted my guess is that you are using ancient/fossile such as Turbo C. Use a modern 32-bit compiler such as free Dev-C++ or free VC++ 2005 Express and you will not get either of those errors.

There are also quite a few syntax errors in the code you posted. It appears to have been originally written with a c++ compiler. Changing to a C compiler will require some rewriting to conform to C standards. Examles: in main() move all data declarations to the top of the function and remove them from the for declarations. The newest C standard permits declaring objects in other places like c++ does but not very many compilers support that yet.

I just noticed that the code you posted also uses c++ class that you will have to rewrite with C linked list. See line 136.

thanks alot, i must use turbo C, and i try to move all data declarations to the top of the function but i have many problems, can you show me how??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.