[C]3장 배열,구조체,포인터
본 자료는 2페이지 의 미리보기를 제공합니다. 이미지를 클릭하여 주세요.
닫기
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
해당 자료는 2페이지 까지만 미리보기를 제공합니다.
2페이지 이후부터 다운로드 후 확인할 수 있습니다.

소개글

[C]3장 배열,구조체,포인터에 대한 보고서 자료입니다.

본문내용

f("\n");
}
void main(){
polynomial A = {2, {1, 3, -2}};
polynomial B = {3, {2, 0, 1, 0}};
polynomial C;
C = mult(A,B);
printf("\n A(x)=");
printpoly(A);
printf("\n B(x)=");
printpoly(B);
printf("\n C(x)=");
printpoly(C);
}
1. 프로그램 3.6
#include
void swap(int *px, int *py)
{
int tmp;
tmp = *px;
*px = *py;
*py = tmp;
}
void main()
{
int a=7;
int b=10;
printf("a = %d , b = %d \n",a,b);
swap(&a,&b);
printf("a = %d , b = %d \n",a,b);
}
2. 프로그램 3.7
#include
typedef struct{
int x;
int y;
}PointType;
int get_line_parameter(PointType p1, PointType p2, float *slope, float *yintercept)
{
if( p1.x ==p2.x ) return (-1);
else{*slope = (float)(p2.y - p1.y)/(float)(p2.x - p1.x);
*yintercept = p1.y - (*slope)*p1.x;
return(0);}
}
void main()
{PointType pt1={3,3}, pt2={6,6};
float s,y;
if(get_line_parameter(pt1, pt2, &s, &y) == -1){
printf("error\n");}
else{printf("rldnfrlsms %f, y절편은 %f\n",s ,y);
}
}
3. 프로그램 3.8
#include
void main()
{
struct{
int i;
float f;
}s, *ps;
ps = &s;
ps->i = 2;
ps->f = 3.14;
printf(" %d , %f \n", s.i, s.f);
}
4. 프로그램 3.9
#include
void foo(int a)
{
printf("foo : %d\n", a);
}
void main()
{
void (*f)(int);
f = foo;
f(10);
(*f)(10);
}

키워드

C,   3장 배열,   구조체,   포인터
  • 가격400
  • 페이지수6페이지
  • 등록일2016.01.14
  • 저작시기2010.6
  • 파일형식한글(hwp)
  • 자료번호#992209
본 자료는 최근 2주간 다운받은 회원이 없습니다.
청소해
다운로드 장바구니