Talk:Array

From Valve Developer Community
Jump to navigation Jump to search

Aren't strings more normally terminated with a NULL? ;-) --Cargo Cult 15:00, 24 Jul 2005 (PDT)

If they're null-terminating strings ;) --ts2do
Thats why strings are supposed to be stored as a char* not a char[] --InvaderZim
Technically strings are terminated with a '\0' character (a character with all bits zero, referred to in the C standard as the null character, all lowercase). On systems that use ASCII this will be the character referred to as NUL (with one L). None of these should be confused a null pointer constant which is 'An integer constant expression with the value 0, or such an expression cast to type void *'. The inclusion of any of several standard headers will also cause the definition of the macro NULL which 'expands to an implementation-defined null pointer constant'. So, depending on the implementation's definition of NULL, the null character and NULL are not necessarily compatible. --Phil

DAWID JOUBERT Arrays and the type of vectors you are refering to are totally unrelated. Arrays are a method of storing information in a sequence, size of the array is static.

Vectors are an advanced method used so that elements can be referenced to by POINTER ADDRESS and so that elements may be removed at any time.

There is a standard implementation of the vector class which can be linked by

  1. include <vector>

http://www.sgi.com/tech/stl/Vector.html http://www.msoe.edu/eecs/ce/courseinfo/stl/vector.htm http://www.fredosaurus.com/notes-cpp/stl-containers/vector/header-vector.html


Further the maths vector you refer to is infact merely a convention on how to store data ie, the following is considered a 3d vector.

struct
{
int x,y,z;
}

Operators are then overloaded to use these vectors for mathematical operations, a maths vector is very closely related to a matrix. DAWID JOUBERT