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.