1

We all know that the code below is an demo code for call by reference,but not pure call by reference, curious about what pure and impure call by reference is? and which programming language's provide pure call by reference.

#include<stdio.h>

void changeX(int *x){
    *x = 90;
}
int main(){
    int x = 100;
    printf("%d ",x);
    changeX(&x);
    printf("%d",x);
    return 0;
}
Mayur Koli
  • 77
  • 8
  • 1
    C++ may be the language you're looking for. See, for example, [this question](https://stackoverflow.com/questions/57483/what-are-the-differences-between-a-pointer-variable-and-a-reference-variable-in) – user3386109 Oct 12 '19 at 08:31
  • 1
    A "pure" function doesn't have any side-effects. If you pass arguments by reference (possibly emulated like in C) or not doesn't matter. – Some programmer dude Oct 12 '19 at 08:37

0 Answers0