what is the other name of pure function?
Answers
Answered by
0
Answer:
A function is called pure function if it always returns the same result for same argument values and it has no side effects like modifying an argument (or global variable) or outputting something. The only result of calling a pure function is the return value. Examples of pure functions are strlen(), pow(), sqrt() etc. Examples of impure functions are printf(), rand(), time(), etc.
If a function is known as pure to compiler then Loop optimization and subexpression elimination can be applied to it. In GCC, we can mark functions as pure using the “pure” attribute.
Similar questions
Environmental Sciences,
2 months ago
Math,
2 months ago
Biology,
2 months ago
Social Sciences,
6 months ago
Math,
6 months ago
Social Sciences,
11 months ago
English,
11 months ago