Talk:Undefined variable

Latest comment: 18 years ago by Pfunk42

The original definition given was this:

  • An undefined variable in a computer program is a variable name that is called by the program but which has not been previously assigned a value by that program.

I think that would describe an "uninitialized variable". For example,

// C
int x;
printf("%d", x);
// x is declared but uninitialized
// Java
Frame x = null;
x.show();
// x is declared but set to null

Some clarification may be needed of the terms

  • undefined variable
  • undeclared variable
  • uninitialized variable
  • NULL (C), null (Java(, nil, or undef (Perl) as in reference or pointer type.

File Not Found 04:01, 8 February 2006 (UTC)Reply

I totally agree. "Definition" == assignment. This article describes, as its first sentence even suggests, undeclared variables. --pfunk42 11:41, 9 November 2006 (UTC)Reply