pointers to data
by: akbar A(syedali011@earthlink.net)
pointers to data.
well i have been learning about the way light has been working for quite some time and i thought that i might take a break from my schedule. I really don't feel like writing about graphics write know, so i thought i might right something about the c programming language ;)
pointers to data are often not used in applications which will benefit quite a bit.
this is how you would go about using this technique.

create the structure you are going to be using.

typedef struct  _numbers{
 float a;
 float b;
 float c;
}numbers;

now we are going to create a few pointer functions to work on this data structure.

numbers *change_numbers(numbers *data) /* note: the data has already been allocated */
{
 data->a = 10;
 data->b = 2;
 data->c = 1;
 return data;
}

numbers *set_numbers()
{
 numbers *p;
 p = (numbers *)malloc(sizeof(numbers));
 p->a = 1;
 p->b = 2;
 p->c = 3;
 return p;
}

By creating the function like this we allow the function type to goto a data type structure and call it like this
numbers_variable_ptr = set_numbers();
this is much more convenient, then having to pass data into the structure, keep variables on the stack etc..
If you like you can create all your function relating to that data type in this same way. It's almost like coding c++ ;)
good luck,
akbar A.