Original Post
Hey everyone! Just a quick question on returning pointers, confused as usual. I'll just use my SDL example, though it has nothing to do with SDL. SDL_Surface *load_image( string filename ) { SDL_Surface *myImg = NULL: // load image stuff // myImg = pic.png return myImg } From what I have been taught and read up on, this shouldn't work, right? When the function is done, aren't the local variables for the function done as well. I know that by using 'new' or static should work, but I know that I'm missing something b/c the way mentioned in the above code IS working for me. Can't wait to see how wrong I am. 8)