JakobCHR.com
 
Quick Navigation:
 
Personal:
 Go to Home
 MS Research
 PhD Research
 Curriculum Vitae

General:
 Linux

Soon to come:
 Matlab
 On-line Stores
 Cycling
 Medicine & Health
 LaTeX
 OOP & C++
 Sony PCM-R500 DAT


next up previous contents index
Next: struct NEUT Up: Data structures Previous: Data structures   Contents   Index

Simple data structures

The simplest data structures we use are vectors and matrices. A vector is a pointer (ie an address) which points to the first element of the vector. The ith element is addressed using [i] after the variable name of the vector. The memory layout of a vector is illustrated in Figure 3.3.

A matrix is a double pointer, ie a pointer which points to an array of pointers whose elements points to an array of matrix elements. The (i,j)th element of the matrix is addressed using [i][j] after the variable name to the matrix. The memory layout of a matrix is depicted in Figure 3.4.

\begin{figure}
% latex2html id marker 13172\rule{\textwidth}{0.2mm}
\rule{0cm}...
... The $*$\ in front of a variable name indicates a
pointer variable.}\end{figure}

\begin{figure}
% latex2html id marker 13192\rule{\textwidth}{0.2mm}
\rule{0cm}...
...riable (ie a pointer which points to another pointer)
respectively.}\end{figure}

 
 

 
 
Revision 2.0, Copyright © 1999-2004 Jakob Christensen
http://www.JakobCHR.com
E-Mail: webmaster@JakobCHR.com
Top Quality
Developed with

Danish
Brain Power
Linux Powered!