c2tarun
November 22nd, 2010, 10:04 AM
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
struct stry
{
int min;
int max;
};
typedef struct stry stry;
struct strx
{
int value;
stry* next;
};
typedef struct strx strx;
void insert(strx* node,int n)
{
//stry* start;
stry* new;
new=node->next;
if(new == NULL)
{
new=(stry*)malloc(sizeof(stry));
new->min=99999;
new->max=-1;
}
if(new->min > n) // this is line number 36
min=n;
if(new->max < n)
max=n;
node->next=new;
return ;
}
this is the small part of a long code. i have main function calling this function.
i m getting this error:
points.c:36: error: ‘min’ undeclared (first use in this function)
can anyone please explain why i am getting this error, as i declared the variable in struct stry and also allocated memory for it.
#include<stdlib.h>
#include<math.h>
struct stry
{
int min;
int max;
};
typedef struct stry stry;
struct strx
{
int value;
stry* next;
};
typedef struct strx strx;
void insert(strx* node,int n)
{
//stry* start;
stry* new;
new=node->next;
if(new == NULL)
{
new=(stry*)malloc(sizeof(stry));
new->min=99999;
new->max=-1;
}
if(new->min > n) // this is line number 36
min=n;
if(new->max < n)
max=n;
node->next=new;
return ;
}
this is the small part of a long code. i have main function calling this function.
i m getting this error:
points.c:36: error: ‘min’ undeclared (first use in this function)
can anyone please explain why i am getting this error, as i declared the variable in struct stry and also allocated memory for it.