Home  |  IT Zone  |  Tips / Tricks  |  Did You Know  |  Inspirational  |  Health  |  World Infos  |  Insurance  |  Universities  |  Forex  |  Mathematics  |  Illusions  |  Children Day Quotes  |  Fun / Jokes  |  Decent Quotes  |  Birthday Msgs  |  Good Morning Msgs  |  Good Night Msg  |  Husband Wife Jokes  |  Teacher Students Jokes  |  Insult Jokes  |  Love Quotes  |  Sad Quotes  |  Funny Pics  |  Be Aware  |  Articles  |  Simple Joys of Life 

What is Arguments Passing By Value Methods?

  • When the argument is sent by value, the original value of the argument does not change after the SUB-Program of function call. To pass the argument by value argument variable is enclosed in parenthesis.

  • Eg: A program to find the sum of the square of the digits in given number.
DECLARE SUB sum (n)
CLS
INPUT "Enter the ending value of the series"; n
PRINT "The value of n before calling the SUB procedure is "; n
CALL sum ((n))
PRINT "The value of n after the completion of the SUB procedure is "; n
END

SUB sum (n)
s = 0
WHILE n <> 0
    r = n MOD 10
    s = s + r ^ 2
    n = n \ 10
WEND
PRINT "The sum of the square of the digits is "; s
END SUB

  • Explanation: 
    • Here, if the user run the program giving the value 45, the output value of n before calling the SUB procedure will be 45.
    • And the value of s will be 41.
    • And the value of n after the completion of SUB procedure will be 45.

Share :

Twitter
Back To Top

facebook main

Powered by Blogger.