+ 1

how can i write an user defined function??

13th Aug 2016, 6:22 PM
Saptarshi Saha
Saptarshi Saha - avatar
4 Antworten
+ 4
ex : void add(int a, int b) { c=a+b; /* variable c has to be defined previously in the main function*/ printf(c); }
13th Aug 2016, 7:55 PM
Roshan Dv
Roshan Dv - avatar
+ 4
example function to swap two integer numbers: void swap(int &x, int &y) { x = x+y; y = x - y; x = x - y; }
14th Aug 2016, 7:11 PM
GTimo
GTimo - avatar
+ 1
return_type function_name(parameters) { instructions.... ..}
13th Aug 2016, 7:45 PM
Oyekunle Oyegunle
Oyekunle Oyegunle - avatar
0
thanks guys
22nd Aug 2016, 1:30 PM
Saptarshi Saha
Saptarshi Saha - avatar