// C11_3.cpp : Defines the entry point for the console application. // 加入除錯程式碼 #include "stdafx.h" #include using namespace std; #include #include #include void Check_String( char *string ); /* 原型宣告 */ int main(int argc, char* argv[]) { char *try1 = "My Word", *try2 = NULL, *try3 = NULL; printf ( "字串分析 \t'%s'\n", try1 ); Check_String( try1 ); printf ( "字串分析 \t'%s'\n", try2 ); Check_String( try2 ); printf ( "字串分析 \t'%s'\n", try3 ); Check_String( try3 ); return 0; } void Check_String( char *string ) { assert( string != "My Word" ); assert( *string != NULL ); assert( strlen(string) > 2 ); /* 長度必須大於 2 字元*/ }