1.1 , ,
main(), main() , (, ..).
main() . , , . , , , , .
extern, .. , , ( ) .
, main(), () .
_ _(__)
{ }
:
_ _(_ )
_ , .. (, int, float, ..) . , void.
_ , , myfunc, sum, mult, F1.
__ ( ) void, , , .
, , .
, . return return. return. . , .. void, return return .
. float. return.
Float sum(float a, float b, float c)
{float S=a+b+c;
return S;}
. . return.
Int max(int x, int y)
{if (x>y)return x;
else return y;}
. . return.
Void prn1(int x)
{ printf(" =%d\n", x);}
. . return.
|
|
Void prn2()
{ puts(" ");}
( ) , . , :
_( )
__ , void, ( , , ).
. .
:
Int max(int x, int y)
{if (x>y)return x; else return y;}
Void main()
{int a=10,res1,res2; float f=55.9;
res1=max(a,20); // res1=20
res2=max(int(f),a+30);} // res2=55
.
int func1(int a, int b) //
{return a+b;}
float sqr(float f, float g) //
{return f*g;}
Void main()
{int am=2,bm=3,res1;
res1=func1(am,bm); //
float em=2.5,gm=3.0,fm=4.2,res2,res3;
res2=sqr(fm,gm); //
res3=sqr(fm+0.5,sqr(em,gm)); //
int res4=(int)sqr(em,float(am)); } //
main() , . . . . . :
float sum(float a, float b, float c);
Int max(int, int y);
float sqr(float, float g);
. , .
#include <stdio.h>
int sum(int, int);//
Void main()
{int a, b=3, g=4;
a=sum(b, g); //
printf("=%d\n", a); }
int sum(int arg1, int arg2) //
{return arg1+arg2;}
1.2
++ ( ) . , () . , . , () , .. . . .
.
#include <stdio.h>