I am getting compilation error for the following code. I have tried my best, but cannot figure it out. Any help will be appreciated.
#include <stdio.h>
#include <stdlib.h>
#define N 100
int counter=0;
struct node {
int value; };
struct node *p = (struct node *) malloc (N*sizeof (node));
void main()
{
int a = 5, b=6;
struct node * c = 0;
c = add(a,b);
}
void add(int m, int n)
{
struct node * pin_1;
struct node * pin_2;
struct node * pin_0;
pin_0->value = m;
pin_1->value = n;
pin_2->value = m + n;
counter++;
printf("value of out is %d /n", pin_2->value);
}
I am getting the error in GCC:
struct_check.c:9:
error:‘node’
undeclared here (not in a function)