I have a rather odd problem. I am trying to pass an array of pointers to objects to a function, which initializes and fills the array. It then returns the number of pointers to objects in the array. The code looks something like this:

Qt Code:
  1. class Material(){..}
  2.  
  3. class MaterialLoader(){
  4. ...
  5. LoadMaterial(const char *path, Material *materials[] ){...}
  6. }
To copy to clipboard, switch view to plain text mode 

The wierd thing is, when the LoadMaterial function is called from another class like this:

Qt Code:
  1. Material **materials = NULL;
  2. MaterialLoader ml;
  3. int num_materials = ml.LoadMaterial(path, materials);
  4. printf("adress of materials is %x\n", materials);
To copy to clipboard, switch view to plain text mode 

the printf points to 0! The array is getting filled within the function, debugging the application as well as printf statements inside LoadMaterial confirm this. It is as though a copy is being made of materials, and that this is being passed to the function, but that's not possible, is it? And yet it must be, since that seems to be what is happening.

Can someone shed some light on this? If you want to compile the code, it can be obtained from http://code.google.com/p/mll/

Thanks in advance.