Q:

Assume that you have the following function and that it has not yet been called

0

Assume that you have the following function and that it has not yet been called.

strfunc.m

function strfunc(instr)

persistent mystr

if isempty(mystr)

 mystr = '';

end

mystr = strcat(instr,mystr);

fprintf('The string is %s\n',mystr)

end

What would be the result of the following sequential expressions?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

strfunc('hi')

strfunc('hello')

>> strfunc('hi')

The string is hi

>> strfunc('hello')

The string is hellohi

>>

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now