I have this function:
void myFunct(const int A, ?out? int B){B = B + A;} 
How to declare B in such a way that the function can update its value and return it to the caller?
I have this function:
void myFunct(const int A, ?out? int B){B = B + A;} 
How to declare B in such a way that the function can update its value and return it to the caller?
 
    
     
    
    Metal is a C++ based programming language that allows you to pass a pointer to a function. To do so, simply declare the function parameter as a pointer type.
void myFunct(const int A, device int *B)
{
   *B = *B + A;
} 
device int *C = 0;
myFunct(1, C);
You can also pass variable by reference:
void myFunct(const int A, device int &B)
{
   B = B + A;
} 
device int *C = 0;
myFunct(1, *C)
or pointer by reference:
void myFunct(const int A, device int *&B)
{
   *B = *B + A;
} 
device int *C = 0;
myFunct(1, C);
