So I am enrolled in a "principles of programming course" and need help understanding these "side effects". My teacher gave me this definition but I need help elaborating and understanding these side effects. Functional side effects: when a function changes a two-way parameter or a non- local variable • Problem with functional side effects: • When a function referenced in an expression alters another operand of the expression; e.g., for a parameter change: a = 10; /* assume that fun changes its parameter */ b = a + fun(&a);

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter11: More Object-oriented Programming Concepts
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

So I am enrolled in a "principles of programming course" and need help understanding these "side effects". My teacher gave me this definition but I need help elaborating and understanding these side effects. Functional side effects: when a function changes a two-way parameter or a non-
local variable
• Problem with functional side effects:
• When a function referenced in an expression alters another operand of the expression; e.g.,
for a parameter change:
a = 10;
/* assume that fun changes its parameter */
b = a + fun(&a);

 

SOMEONE PLEASE PROVIDE EXAMPLES!!!

Example Side Effects
●
●
modifying a non-local variable
modifying a static local variable
modifying a mutable argument passed by reference
performing I/O or calling other functions with side-effects
Transcribed Image Text:Example Side Effects ● ● modifying a non-local variable modifying a static local variable modifying a mutable argument passed by reference performing I/O or calling other functions with side-effects
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Concept of Parenthesis
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning