Pass by Reference in C

Home Forums C-programming.. Pass by Reference in C

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #2127 Reply
    Humble
    Keymaster

    hmmm.. C does not have “strict pass by reference” concept. Even-though everyone says it exist , in reality “pass by reference” does not exist in C .

    pass by reference is an illusion 🙂 .. That said, ‘pass by reference” examples are mainly carved with the help of below format.

    int f1(int *p)
    {
    .....
    return ...
    }
    
    int main()
    {
    int i = 5;
    
    f1(&i)
    }
    
    
    Here the actual passing of argument to f1() happens with "pass by value" , how-ever we tend to say "it is pass by reference" being the address is passed to f1.. Here the "address" is passed/copied to "p",so again its pass by value..
Viewing 1 post (of 1 total)
Reply To: Pass by Reference in C
Your information: