Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

pass address to function c++

#include <stdio.h>

void swapnum(int &i, int &j) {
  int temp = i;
  i = j;
  j = temp;
}

int main(void) {
  int a = 10;
  int b = 20;

  swapnum(a, b);
  printf("A is %d and B is %d
", a, b);
  return 0;
}
Source by www.ibm.com #
 
PREVIOUS NEXT
Tagged: #pass #address #function
ADD COMMENT
Topic
Name
8+6 =