이문제 안되네요..^^;;
Emily
#include stdio.h
#include math.h
double for1(double(*pf)(double), int n);
double f1(double k);
double f2(double k);
int main ()
{
printf(%f\n,for1(f1,10));
printf(%f\n,for1(f2,10));
return 0;
}
double for1(double(*pf)(double), int n)
{
int i;
double sum=0.0;
for(i=0;in;i++)
sum+=pf(i)*pf(i)+pf(i)+1;
return sum;
}
double f1(double k)
{
return 1.0/k;
}
double f2(double k)
{
return cos(k);
}
이거는 값이 for1(f1,10) 이상하게 나오고 for1(f2,10)은 숫자는 나오는데 교재랑 다르네요 문제점이 뭘까욤^^;
#include stdio.h
void setmax(int m[],int size, int **pmax1);
int main ()
{
int m[6]={5,6,1,3,7,9};
int *pmax;
setmax(m,6,&pmax);
printf(*pmax=%d\n,*pmax);
return 0;
}
void setmax(int m[],int size, int **pmax1)
{
int max=m[0],i;
for(i=1;isize;i++)
if(maxm[i])
max=m[i];
**pmax1=max;
}
이게 안되네요.
-
봉봉
제가 알기론
가인수 int m[] 으로 배열m을 인자값으로 전달하면 못 받습니다.
배열=배열 복사가 안되죠. 그래서 포인터나 레퍼런스를 이용해야 할 것 같습니다.