第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

為什么第三行的代碼要用 static 而不是 extern ?

#include <stdio.h>

extern void printLine();

static void say()

{

? ? printLine();

? ? printf("I love imooc\n");

? ? printf("good good study!\n");

? ? printf("day day up!\n");

? ? printLine();

}


正在回答

2 回答

因?yàn)榈谌惺莾?nèi)部的 外部是*

0 回復(fù) 有任何疑惑可以回復(fù)我~

本人新手,目前是這樣理解的,要是不對(duì)望大神指點(diǎn)

#include?"test.c"???//引用test.c文件----#include的作用純粹就是內(nèi)容拷貝,運(yùn)行時(shí)被包含文件test.c中的文本將替換源代碼文件中的#include 指令;用extern定義say()函數(shù),程序運(yùn)行時(shí)相當(dāng)于hello.c與test.c中都定義了外部函數(shù)say(),而C語(yǔ)言規(guī)定不允許有同名的外部函數(shù),所以編譯會(huì)報(bào)錯(cuò)。

不使用#include?"test.c"時(shí)則需用extern定義say()函數(shù):

hello.c

#include?<stdio.h>
//#include?"test.c"???//引用test.c文件
extern?void?printLine()?//這里定義的方法對(duì)嗎?
{
???printf("**************\n");???
}
int?main()
{
????extern?void?say();
????say();
????return?0;
}

test.c

#include?<stdio.h>
extern?void?say()
{
????extern?void?printLine();?
????printLine();
????printf("I?love?imooc\n");
????printf("good?good?study!\n");
????printf("day?day?up!\n");
????printLine();
}


3 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為什么第三行的代碼要用 static 而不是 extern ?

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)