Turbo-C
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
터보-C 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
Lua 게시판
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C/C++ Q/A
[6115] 헤더파일 에러가 나는데 어째야 할지 모르겠습니다 도와주세요
남지민 [] 2452 읽음    2007-12-10 06:54
//cell.h
typedef struct cellCDT *cell;
cell new_cell(void);  /* create new cell*/
void create_child( cell x, int y);  /*creates a child in given cells children area with value*/
void free_cell( cell x ); /* frees cell */
float get_val(cell x);   /*return strng held in cell*/
void c_val(cell x, float y);   /* change value of cell*/
cell lreturn(cell x);
cell rreturn(cell x);

---------------------------------------------------------------------------------------


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cell.h"

struct cellCDT{
  struct cellCDT* left;   //struct of each cell uniform across all
  struct cellCDT* right;        //due to laziness
  float value;
}



/*//////////////////////////////////////////////////////////
// creates and initializes new cell with no input
//
//////////////////////////////////////////////////////////*/
void new_cell()
{
  cell new = (cell)malloc( sizeof(*new) );
  new->left=NULL;
  new->right=NULL;
  new->value=0;
  return new;
}


/*********************************************************
** create child under a cell and add pointer to that cell's newly expanded
**array
******************************************************************************/
void create_child( cell x, int y)
{
  cell child_cell = new_cell();
  if(y==0)
    {
      x->left = child_cell;
      //innate bias to do nothing
    }
  else x->right = child_cell;
}


/***************frees all parts of cell and then frees self*******************/
void free_cell( cell x )

   if(x->left != NULL) free_cell(x->left);
   if(x->right != NULL) free_cell(x->right);
   free(x);
}


/***************return strng held in cell*************************************/
float get_val(cell x)
{
  return x->value;
}

/**************change value of cell******************************************/
void c_val(cell x, float y)
{
  x->value = x->value + y;
}

cell lreturn(cell x)
{
  return x->left;
}

cell rreturn(cell x)
{
  return x->right;
}

+ -

관련 글 리스트
6115 헤더파일 에러가 나는데 어째야 할지 모르겠습니다 도와주세요 남지민 2452 2007/12/10
6116     Re:헤더파일 에러가 나는데 어째야 할지 모르겠습니다 도와주세요 최준호.스페로 4020 2007/12/11
6118         Re:Re:헤더파일 에러가 나는데 어째야 할지 모르겠습니다 도와주세요 남지민 2700 2007/12/12
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.