Not Yet Answered # coorect a C error m expected

Narue 5,707 Discussion Starter sara_84 4 Aia 1,977 Discussion Starter sara_84 4 iamthwee 1,547 Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...

Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...

0

If what you posted is what you're actually trying to compile, it's no surprise. No part of that code is valid.

0

no, it is only part, and this is my code

```
#include<stdio.h>
#include <stdlib.h>
#include<string.h>
#include<stddef.h>
#include <malloc.h>
/*#include<stack.h>*/
#define MAX 100
#define TRUE 1
typedef struct node node
struct
{ int
long 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];
int empty = TRUE;
int read()
{
int a;
int k;
int b;
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(a=0; a<fnodes; a++)
{
scanf("%d ",states);
cont = -1;
for(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(a=0; a<nodes; a++)
{
for(b=0; b<nodes; b++)
{
scanf(" %d %d " ,graph[a][b]);
}
}
if(counter>1)
return -1;
return 1;
}
void calc()
{
int a;
int b;
for(a=0;a<30;a++)
{
for(b=0;b<30;b++)
{
if(a*b<100)
graph[a][b]=0;
else
graph[a][b]=1;
}
}
}
bool compareVertex(int v)
{
int k;
for(k=0; k<counter2; k++)
if(final[k]==v)
{
/*printf(" %d , %d " ,final[k],v);*/
return true;
}
return false;
}
void dfs(int vertex)
{
int i;
/*printf(" %d ",vertex);*/
if(compareVertex(vertex))
empty=false;
visit[vertex] = 1;
for (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()
{
int i,b;
for(a=0;a<nodes;a++)
{
for(b=0;b<nodes;b++)
{
printf(" %d ",graph[a][b]);
}
}
}
int main()
{
int j,h ;
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 (i=0;i<nodes;i++)
visit[i] = 0;
for(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;
}
```

0

typedef struct node node

struct

{ int

Is it obvious you are trying to define a structure type, but that's not the way of doing it.*exempli gratia*

```
typedef struct node
{
int first;
int second;
int etc; /* i.e. char, floats, arrays, pointer or struct */
};
/* after that you can declare a variable of type node */
node my_node;
```

0

typedef struct node node

{ int a;

thanks, but the error is appears ( , expected)

tell me for what this error

0

It's obvious you just found that code from somewhere on the net and your are desperately trying to make it work for you.

I would recommend starting from the beginning with your own code, because then they will be your own ideas and ultimately you will get a lot more out of it.

This article has been dead for over six months. Start a new discussion instead.

Recommended Articles

Hi. Im using vb 2010. I want to dynamically add textboxes to my form by clicking on a button. I've google searched and so far this code worked:

```
Private Sub btn_addline_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_addline.Click
Dim txtB1 As New TextBox
Dim i
For i = ...
```