Here is the error message:
assignment1.c: In function `gateInput':
assignment1.c:24: error: syntax error before "int"
and here is the code:
#include "stdlib.h"
#include "assert.h"
#include "stdio.h"
#include "circuit.h"
int main(int argc, char * argv[])
{
int i;
struct gate * g;
printf("type an integer:\n");
scanf("%d", &i);
g = gateInput(&i);
gatePrint(g);
return 0;
}
struct gate * gateInput(int * value)
{
struct gate * d = gateConstant(int * value);
return d;
}
struct gate * gateConstant (int value)
{
struct gate * r = (struct gate *) malloc(sizeof(struct gate));
assert(r != 0);
if (value == 0)
return gateZero();
if (value == 1)
return gateOne();
}
struct gate * gateZero()
{
struct gate * r = (struct gate *) malloc(sizeof(struct gate));
assert(r != 0);
r -> gateType = ConstantZeroGate;
printf("EnteredValue: ", &r);
return r;
}
struct gate * gateOne()
{
struct gate * r = (struct gate *) malloc(sizeof(struct gate));
assert(r != 0);
r -> gateType = ConstantOneGate;
printf("EnteredValue: ", &r);
return r;
}
void gatePrint (struct gate * e)
{
struct gate * print = e;
printf("The entered Value: ", &print);
}



LinkBack URL
About LinkBacks


