Bertolt Brecht What a miserable thing life is: you're living in clover, only the clover isn't good enough.
C header file example
category: C/C++ |
Tag List: c    compile    header   
posted by : jazzvm
view count : 585
2010-02-06 14:28:37, EST: 2010-02-06 00:28:37
posted about 7 months ago
°¡²û ÀÛ¾÷À» ÇÒ¶§, ÁÖ·Î visual studio °°Àº ÅøÀ» »ç¿ëÇÏ´Ù º¸´Ï,
Çì´õ ÆÄÀÏÀ» ºÐ¸®Çؼ­ ÀÛ¼ºÇϰí ÄÄÆÄÀÏÇÏ´Â ¼öÀÛ¾÷À» ÇÏ·Á´Ï, ¸Ó¸®°¡ ¾ÆÂñÇØÁø´Ù.
(³­ C/C++ ÃÊÂ¥¶ó¼­..)


header file


math.h
int sum (int lhs, int rhs);
int sub (int lhs, int rhs);




implementation


math.c
int sum (int lhs, int rhs) {
  return lhs + rhs;
}

int sub (int lhs, int rhs) {
  return lhs - rhs;
}




main file


main.c
#include <stdio.h>
#include "jazzvm_math.h"

main () {
  printf("summation: %i\n", sum(2, 3));
  printf("subtraction: %i\n", sub(2, 3));
}




compile and run

yonghyun-yoons-macbook:header jazzvm$ gcc main.c jazzvm_math.c -o main
yonghyun-yoons-macbook:header jazzvm$ ./main
summation: 5
subtraction: -1


posted(2010-02-06): www.jazzvm.net/board/view.jazz?seq=1329

µµ¿òÀÌ µÇ¾ú°Å³ª, ÀǰßÀÌ ÀÖÀ¸½Ã¸é Ä¿¸àÆ®¸¦ ³²°ÜÁÖ¼¼¿ä. ±ÛÀ» ÀÛ¼ºÇÒ ¶§¿¡ Âü°í°¡ µË´Ï´Ù.
Please leave any comment or opinion regarding this posting. Particularly when you want to refer to this.
That would provide me with good motivation.

thanks --jazzvm

Name:   PWD:
Five Numbers[nine eight nine two two] :   ex)[zero one two three four] : 01234
C header file example jazzvm 2010-02-06 14:28:37