• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

'NULL' undeclared?

Incinerator

Limp Gawd
Joined
Aug 31, 2005
Messages
252
hey, I'm getting an error that says

'NULL' undeclared (first use this function)

and thats my last error to fix and I was just wondering how to go about it, since I have no idea what is wrong.

Thanks
 
Whats Wrong? Its not defined.
:)

Without some more details like Language or a Code Example we might be able to help.
 
right on!

in java null is usually in lowercase


if(Incinerator == null){
Incinerator= new Incinerator();
}
 
ok well this is in C++ and I'm trying to implement priority queues and it just keeps giving me that error, and only that error and its getting pretty annoying.

Code:
struct Cell
{
  Cell* next;
  int item;
  double priority;
  Cell(int i, Cell* n)
  {
    item = i;
    next = n;
  }
  Cell(Cell* L, int v, double p)
  {
    priority = p;
    item = v;
    next = L;
  }
};

struct pQueue
{
  Cell* ptr;
  pQueue()
  {
    ptr = null;
  }
};

I dont see whats wrong, with saying ptr = null...
 
Yeah, C++ only accepts NULL...you got it right in your thread title?
 
i'm not sure if it's pre-defined in c++ but in c you need to include something from the standard library to get NULL, i.e.
#include <stdio.h>
so you may have to include something before it's defined, not sure though.
 
yea, thats another way to do it

#ifndef NULL
#define NULL 0L
#endif

think I got it right
 
Back
Top