Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

c pass int by reference

void func(int *v){
  (*v)++;
}

int
main () {
    int a = 5;
    func(&a);
    printf("a: %d
", a); // output-> a: 6
    
    return 0;
}
 
PREVIOUS NEXT
Tagged: #pass #int #reference
ADD COMMENT
Topic
Name
6+4 =