basic pointer question

WhatMeWorry kheaser at gmail.com
Fri Jul 11 22:17:02 UTC 2025


```
// working function

SDL_Texture* changeTextureAccess(SDL_Texture *texture, 
SDL_TextureAccess newAccess)
{
     // pertinent code only
     texture = createTexture(renderer, pixelFormat, newAccess, 
width, height);
     return texture;
}
```

The above function is working for me when I call it with:
```
SDL_Texture* sameTexture = changeTextureAccess(sameTexture, 
SDL_TEXTUREACCESS_STREAMING)
```
but I thought a better solution would be simply:
```
void changeTextureAccess(SDL_Texture **texture, SDL_TextureAccess 
newAccess)
```
Isn't the only way to update a function parameter is by making it 
a pointer?
So I thought something like
```
*texture = createTexture(renderer, pixelFormat, newAccess, width, 
height);
```
would work but that just leads to a whole bunch of other lines of 
code returning compiler errors.  Am I at least on the right track 
here?  I've been throwing lots of * and & all around and not 
getting anywhere?




More information about the Digitalmars-d-learn mailing list