What is the output of the following code? [code]function maha= orchid(polo,varargin) disp(polo) wish=sum(varargin{1,2}) end p=rush(-1:1,Inf)[/code]

Mỹ An

New member
What is the output of the following code?
Code:
function maha= orchid(polo,varargin)
disp(polo)
wish=sum(varargin{1,2})
end
p=rush(-1:1,Inf)
A. Logical error in varargin
B. Syntactical error in varargin
C.
p{1}=-1 0 1
wish=0
D. No output
 
Answer: a
Explanation: Varargin is a 1*N cellular array. The index number given as input to the varargin command looks like we are calling the element in the 2$^{nd}$ row and the 1$^{st}$ column which is not there. Hence, there is logical error in using the varargin keyword.
 

Tìm kiếm

Back
Top