int main (int argc, char *argv[])
{
int a, b, quo, rest;
void division(int dividendo, int divisor, int *ptr_quociente, int *ptr_resto)
{
*ptr_quociente=dividendo/divisor;
*ptr_resto=dividendo%divisor;
}
if(argc=3)
{
a= atoi(argv[1]);
b= atoi(argv[2]);
division(a,b,&quo,&rest);
printf(" %d and %d \n",quo,rest);
}
else if (argc=1)
do
{
printf("type two int numbers:\n");
scanf("%d %d", &a, &b);
division(a,b,&quo,&rest);
printf(" %d and %d \n",quo,rest);
} while(a!=0);
}
내가 할 경우 :왜이 세분화 오류 (코어 덤프) ??? int 주 (int argc, 문자의 *의 변수는 argv는 [])
./program.c 12 6
그것은 작동하지만 난 할 경우 :
나는 세그먼트 오류를 얻을 수 ./program.c, 왜? 이는
LHS
에
constant
을 유지하는 좋은 아이디어는 항상 이유
'argc = 3'은'argc == 3 '이어야합니다. –
감사합니다! 나는 그것을보아야한다. 피곤한 ... – Bryant2