Hey, What's the difference between actual and formal parameters as in Turbo Pascal or C programming?

3 Answers

Relevance
  • Chris
    Lv 7
    2 years ago
    Favorite Answer

    When you define a function:

    function Say(string message) {

    // show message on screen

    }

    Here, message is the formal parameter, the "word" you use inside the function to access what was passed.

    Now when you call the function, it might look like this: Say("Hello");

    Here, "Hello" is the actual parameter.

  • 2 years ago

    In programming languages that use those terms (I think Pascal is one of them), a formal parameter is the name used in a function or procedure to refer to a value that will be passed from a caller. An actual parameter is the value provided by the calling code on a particular call of a function or procedure.

    So, the actual parameter is the value provided by the caller and the formal parameter is the name used within the function to refer to the caller's value.

    C and C++ use different terms: a "parameter" is the name used in the function and an "argument" is a value passed to a function by a caller.

    Not all teachers of C/C++ use those terms, but that's what you'll see in all formal descriptions of these languages from Dennis Ritchie's first C user's manual to all of the ISO C and C++ specifications.

  • 2 years ago

    They is enough difference

Still have questions? Get your answers by asking now.