Wednesday 23 January 2013

Value return from function



%---------------------------
main file c is
p=show();
fprintf('cube=%d\n',p);
%--------------------------


 %here i use a program that tell us how value return from function %



function[z]=show();
x=input('Enter any number\n');

z=1;
z=x*x*x;


  in c++ we use this syntax as
%------------------------------
 
 z=x*x*x;
return z;

but here we return the variable in the above function as
syntax as


  function[z]=show();
% that's mean we return z after calculation to the function show() which use in c.m file

0 comments:

Post a Comment