047. 함수와 인수 이해하기047. 함수와 인수 이해하기

Posted at 2010. 11. 22. 04:29 | Posted in Computer/초보자를 위한 C 언어 300제
#include <stdio.h>

int print( char* string );

main()
{
	print( "This i a function!" );
}

int print( char* string )
{
	int len = 0;

	while(*string != (char)NULL )
	{
		printf( "%c", *string );
		string++;		// 번지 값을 1 증가
		len++;		// 문자열의 길이를 1 증가
	}

	return len;		// 총 문자열의 길이를 반환
}

'Computer > 초보자를 위한 C 언어 300제' 카테고리의 다른 글

049. #include 문 이해하기  (0) 2010.11.22
048. 변수의 범위 이해하기  (0) 2010.11.22
046. 데이터형 정의하기  (0) 2010.11.22
045. 열거형 이해하기  (0) 2010.11.22
044. 공용체 이해하기  (0) 2010.11.22
//

046. 데이터형 정의하기046. 데이터형 정의하기

Posted at 2010. 11. 22. 04:27 | Posted in Computer/초보자를 위한 C 언어 300제
#include <stdio.h>

#define true 1
#define false 0

typedef int bool;

main()
{
	bool bCondition;

	bCondition = true;

	if( bCondition == true )
	{
		printf( "조건식은 true입니다." );
	}
}

'Computer > 초보자를 위한 C 언어 300제' 카테고리의 다른 글

048. 변수의 범위 이해하기  (0) 2010.11.22
047. 함수와 인수 이해하기  (0) 2010.11.22
045. 열거형 이해하기  (0) 2010.11.22
044. 공용체 이해하기  (0) 2010.11.22
043. 구조체 이해하기  (0) 2010.11.22
//

045. 열거형 이해하기045. 열거형 이해하기

Posted at 2010. 11. 22. 04:24 | Posted in Computer/초보자를 위한 C 언어 300제
#include <stdio.h>

enum { Sun=0, Mon, Tue, Wed, Thr, Fri, Sat };

main()
{
	printf( "%d ", Sun );		// 0
	printf( "%d ", Mon );		// 1
	printf( "%d ", Tue );		// 2
	printf( "%d ", Wed );		// 3
	printf( "%d ", Thr );		// 4
	printf( "%d ", Fri );		// 5
	printf( "%d ", Sat );		// 6
}
//