|
http://www.hackerschool.org/HS_Boards/zboard.php?AllArticle=true&no=2830 [복사]
/* func_add.c */
#include <stdio.h>
int Add(int a,int b);
int Input(void);
void Result_Print(int val);
void Intro(void);
int main(void)
{
int a,b;
int output;
Intro();
a=Input();
b=Input();
output=Add(a,b);
Result_Print(output);
return 0;
}
int Add(int i,int j)
{
int result=i+j;
return result;
}
int Input(void)
{
int input;
scanf("%d",&input);
return input;
}
void Result_Print(int val)
{
printf("덧셈에 대한 결과:%d \n",val);
printf("END \n");
}
void Intro(void)
{
printf("start \n");
printf("두 개의 정수 입력:");
}
여기서 a=input(); ,b=input(); 이건데
int Input(void)
{
int input;
scanf("%d",&input);
return input;
}
이뜻이 Input이라는 함수에 input이라는 변수를 주고 입력한값을 input에 저장해서 int형태로 출력하라라는 뜻이라고 생각하는데 a=input(); ,b=input(); 이거를 그냥 a나b에 대입안하고 input(); 이라고만해놓으면 실행은되는데 오류가뜨더라구요
왜그런거죠?? 제생각엔 입력한값이 Input함수에잇는 input이라는 변수에저장되고 a=input(); ,b=input(); 이거처럼 a나 b에 대입하라는 소리가없으니깐 그냥 쓰레기값처럼 될꺼같은데 아닌가요?? 왜그런지좀 설명부탁드립니다 |
Hit : 4843 Date : 2011/01/02 08:45
|