推 x000032001:while(cin或scanf){call func} 這樣嗎0.0 02/05 14:30
→ rushcloud:我也不知道欸@@" 就是A call B 個過程不會寫... 02/05 14:37
→ rushcloud:看了help 他是寫int main(int argc, char **argv) 02/05 14:39
→ rushcloud:main裡面有 test() 這樣好像是call test 對嗎? 02/05 14:40
推 x000032001:這樣就是call test 02/05 14:41
→ rushcloud:再問一下int main(int argc, char **argv) 是做什麼的? 02/05 14:49
推 x000032001:程式進入點阿 該怎麼說咧 就是從那行開始run吧. 02/05 14:53
→ rushcloud:那argc跟 char **argv呢? 不好意思 問題多了點@@" 02/05 14:57
推 bigbite:argc表示當初call這個program時候的參數數量 02/05 15:00
→ bigbite:argv則是記錄了那些參數... 假設今天在cmd.exe底下 02/05 15:00
→ bigbite:C:\> a.exe para1 para2 02/05 15:00
→ bigbite:argv[0]就是a.exe argv[1]就是para1 argv[2]就是para2 02/05 15:01
推 VictorTom:看這過程, 建議你還是找本書或找個網路教材, 一步一步學 02/05 15:02
→ VictorTom:吧; 又或者你的B不用自己寫, 只是像要call printf()這樣 02/05 15:03
→ VictorTom:來顯示結果之類的....@_@" 02/05 15:03
這是我測試的code
#include <stdio.h>
#include <stdlib.h>
void test()
{
printf ("Hello");
}
int main(int argc, char argv)
{
test();
return (0);
system("pause");
}
編譯成功 不過結果沒顯示出來@@"
怎麼會這樣...
※ 編輯: rushcloud 來自: 203.67.54.194 (02/05 15:07)
→ rushcloud:argv前面有加** 也是沒顯示出來... 02/05 15:08
推 VictorTom:把return 0放到system()那行後面. 02/05 15:11
→ bigbite:return 0;要放在system("pause");後面 02/05 15:11
→ VictorTom:return 0就離開main了, 後面的pause沒執行到.... 02/05 15:11
→ VictorTom:或者你開命令提示字元執行編出來的xxx.exe, 也行. 02/05 15:11
→ rushcloud:太感激了 謝謝^^ 02/05 15:15
→ flydragon198:其實他有顯示出來,只是一下子就跳掉了~~ 02/05 15:17
推 appleboy46:就如同上面說的,有跑只是你沒看到 02/05 15:43
推 vup4jp6:main都結束了 如何執行SYSTEM 02/05 16:16
推 IsMe1086:XDDDD 02/06 14:23