Hi i'm a little confused about a pointer issue.
Code:
var sound_handle = 0 // variable sound handle
var* pnt_to_sound = &sound_handle; // pointer to handle


Ok, all well and good, the pointer is set to point to the variable.

Now i'm trying to play a sound and return the handle into the var.

Setting it directly...
Code:
sound_handle = snd_play("hi.wav",100,0);


no errors here. Setting it through the pointer...
Code:
*pnt_to_sound = snd_play("hi.wav",100,0);


Produces a crash. I thought it would work like this because dereferencing the pointer gets you the variable.

I dont really work with pointers (i'm a C# guy), so i dont know what's wrong.

Last edited by DJBMASTER; 08/20/09 07:51.