Call By Reference Example
void swap_regular(int a, int b)
{
int temp;
temp = a;
a = b;
b = temp;
}
void swap_pointer(int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
void swap_cplusplus(int &a, int &b)
{
int temp;
temp = a;
a = b;
b = temp;
}
Previous slide
Next slide
Back to first slide
View graphic version