聲明外部變量(extern變量)的使用

#include <stdio.h>
float fun(float x, float y);/*porpotypes declaration*/
float sum(float x, float y)/*define*/
{
    float s = 0;
    s = x+y;
    return s;
}
void main()
{
    extern float a, b; /*declare extern variables*/
    float s;
    s = sum(a, b);
    printf("s = %.2f\n",s);
}
float a = 10, b = 20;  /*define extern variables*/
相關文章
相關標籤/搜索