Archive

Posts Tagged ‘c++’

[C++] Data types and sizes

July 23, 2012 Leave a comment

char
– int로 취급 가능 (‘a’ -> 48)

int (short, long-L)
float – F (short, long)
double (short, long)

singed, unsinged (U)를 함께 사용할 수 있다.

short, int, long의 size 비교
short string == char[]
string은 char의 배열로 끝에 ”을 저장한다.

"ab"
 - char[0] = 'a'
 - char[1] = 'b'
 - char[2] = ''

Categories: Programming Tags:

[C++] Declaring functions

July 23, 2012 Leave a comment

How to declare functions…

int some_function1();
void some_function2(int n);
int some_function3 (int n, char src[]);

사용자 정의 함수는 main() 함수를 구현하기 전에 선언한 다음 구현한다.
#include 와 main() 함수 사이에 선언한다.

Categories: Programming Tags:

[C++] Constant

July 23, 2012 Leave a comment

How to define constant…

#define MAXLINE 1000
#define EOF ”
#define EXPRESSION “%d + %d = %d”

#define 키워드를 사용하여 상수를 선언한다.

Categories: Programming Tags:

[C++] Useful headers

July 23, 2012 Leave a comment

How to define in main function?

  • #include <stdio.h>
  • stdio.h : 기본적인 함수들.
  • string.h : string 관련한 함수들
  • limits.h : data type의 size와 관련한 상수들
  • float.h :
  • ctype.h : character와 관련한 테스트 및 변화 함수들.
Categories: Programming Tags: