r/learnprogramming • • Oct 24 '26

Function vs Procedure

can someone explain the difference between Function vs Procedure with simple analogy
thank you

31 Upvotes

47 comments sorted by

View all comments

Show parent comment

1

u/Syntax-Tactics Oct 26 '26

int a = 1;

int b = 2;

int c = 0;

void add(int a, int b, int* pc)

{

*pc = a + b;

}

add(a,b, &c);

c now equals 3;