1.

What are persistent variables?(a) Variables which retain values between calls to the function(b) Variables which help in calling a function(c) Variables which deal with functions(d) Variables global to the functionI had been asked this question in a national level competition.The query is from Functions topic in division MATLAB Basics of MATLAB

Answer»

The correct option is (a) Variables which retain values between CALLS to the function

For explanation I would say: PERSISTENT variables help to retain the value which has been produced by a sub-function. They are LOCAL to the sub-function but MATLAB reserves permanent storage for them so they might seem like global variables. They are never SHOWN in the workspace so they DIFFER from global variables.



Discussion

No Comment Found

Related InterviewSolutions