ɾ³ýC/C++×¢ÊÍ
/********************************************************************
*ɾ³ýC/C++×¢ÊÍ
**********************************************************************/
#include <stdio.h>
//×¢Òâ
//1.¶Ô/****/µÄ´¦Àí
//2.Òª±£ÁôË«ÒýºÅÖ®¼äµÄÄÚÈÝ£¬Èçchar* test = "/*i am not comment */";
//3.¶ÔÓÚµ¥ÒýºÅÖеÄÄÚÈÝͬÑù±£Áô(²»¼ì²é³ÌÐòµÄÓï·¨´íÎó)
//4.¶ÔÓÚתÒå×Ö·ûµÄ´¦Àí(¼û״̬6)£¬Èçchar* test = "string\"string too/*i am not comment"
int noComment(FILE *in,FILE *out)
{
int ch, lastch, state = 0, sq = 0;
while( ( ch = fgetc(in) ) != EOF )
{
switch(state)
{
case 0:
if( ch == '/' )
{
lastch = '/' ;
state = 1 ;
}
else
{
if( ch == '\'' || ch == '"' )
{
state = 5 ;
if( ch == '\'' )
sq = 1;
}
fputc(ch, out);
&n
Ïà¹ØÎĵµ£º
ÕâÆªÎÄÕÂÊÇʹÓÃSQLite C/C++½Ó¿ÚµÄÒ»¸ö¸ÅÒª½éÉܺÍÈëÃÅÖ¸ÄÏ¡£
ÓÉÓÚÔçÆÚµÄSQLiteÖ»Ö§³Ö5¸öC/C++½Ó¿Ú£¬Òò¶ø·Ç³£ÈÝÒ×ѧϰºÍʹÓ㬵«ÊÇËæ×ÅSQLite¹¦ÄܵÄÔöÇ¿£¬ÐµÄC/C++½Ó¿Ú²»¶ÏµÄÔö¼Ó½øÀ´£¬µ½ÏÖÔÚÓг¬¹ý150¸ö²»Í¬µÄAPI½Ó¿Ú¡£ÕâÍùÍùʹ³õѧÕßÍû¶øÈ´²½¡£ÐÒÔ˵ÄÊÇ£¬´ó¶àÊýSQLiteÖеÄC/C++½Ó¿ÚÊÇרÓõģ¬Òò¶øºÜÉÙ±»Ê¹Óõ½¡£¾¡¹ÜÓÐÕâ ......
×ÜÊDZ»Í¬Ñ§ÃÇÎʵ½,ÈçºÎѧϰCºÍC++²Å²»Ã£È»,²Å²»ÊÇÂÒѧ¡£ÏëÁËÒ»ÏÂ,ÕâÀï¸ø³öÒ»¸ö×ܵĻظ´¡£
Ò»¼ÒÖ®ÑÔ,»¶ÓÅÄש¹þ¡£
1¡¢¿ÉÒÔ¿¼ÂÇÏÈѧϰC
´ó¶àÊýʱºò,ÎÒÃÇѧϰÓïÑÔµÄÄ¿µÄ,²»ÊÇΪÁ˳ÉΪһ¸öÓïÑÔר¼Ò,¶øÊÇÏ£Íû³ÉΪһ¸ö½â¾öÎÊÌâµÄר¼Ò¡£×öÒ»¸öÓ ......
1¡¢°²×°»ù´¡Àà¿âºÍman°ïÖúÎĵµµÈ
sudo apt-get install build-essential sun-java6-jdk debian-keyring g++-multilib g++-4.2-multilib gcc-4.2-doc libstdc++6-4.3-dbg equivs glibc-doc manpages-dev libstdc++6-4.3-doc diff-doc binfmt-support sun-java6-source manpages manpages-posix manpages-posix- ......
Õâ¸öÌá·¨Óеã¹ÖÒ죬µ«»¹Êdz£³£³öÏÖ:
char *p = "abcd";
ºÍ
string str = "abcdefg";
µÚÒ»¸ö½Ð×öC·ç¸ñµÄ×Ö·û´®£¬ÔÒòÊÇÓÐnull×÷Ϊ½áβ; µÚ¶þ¸öΪC++·ç¸ñµÄ, ²»ÊÇÒÔnull½áβ.
ʵÖÊÉÏ: C·ç¸ñµÄ×Ö·û´®ÊÇ:
char[] pArr = {'a', 'b', 'c', 'd', '\0'};
ÕâÑù¾ö¶¨ÁË´¦Àí·½Ê½µÄ²»Í¬ ......
externÊÇC/C++ÓïÑÔÖбíÃ÷º¯ÊýºÍÈ«¾Ö±äÁ¿×÷Ó÷¶Î§£¨¿É¼ûÐÔ£©µÄ¹Ø¼ü×Ö.
Ëü¸æËß±àÒëÆ÷£¬ÆäÉùÃ÷µÄº¯ÊýºÍ±äÁ¿¿ÉÒÔÔÚ±¾Ä£¿é»òÆäËüÄ£¿éÖÐʹÓá£
1¡£¶ÔÓÚextern±äÁ¿À´Ëµ£¬½ö½öÊÇÒ»¸ö±äÁ¿µÄÉùÃ÷£¬Æä²¢²»ÊÇÔÚ¶¨Òå·ÖÅäÄÚ´æ¿Õ¼ä¡£Èç¹û¸Ã±äÁ¿¶¨Òå¶à´Î£¬»áÓÐÁ¬½Ó´íÎó
2¡£Í¨³££¬ÔÚÄ£¿éµÄÍ·ÎļþÖжԱ¾Ä£¿éÌṩ¸øÆäËüÄ£¿éÒýÓõĺ¯ÊýºÍÈ«¾Ö ......