What's the difference between an argument and a parameter?

后端 未结 30 2261
北恋
北恋 2020-11-22 01:08

When verbally talking about methods, I\'m never sure whether to use the word argument or parameter or something else. Either way the other people know what

30条回答
  •  没有蜡笔的小新
    2020-11-22 01:44

    This example might help.

    int main () {
       int x = 5; 
       int y = 4;
    
       sum(x, y); // **x and y are arguments**
    }
    
    int sum(int one, int two) { // **one and two are parameters**
       return one + two;
    }
    

提交回复
热议问题