删除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
相关文档:
Delphi 与 C/C++ 数据类型对照表
Delphi数据类型C/C++
ShorInt
8位有符号整数
char
Byte
8位无符号整数
BYTE,unsigned short
SmallInt
16位有符号整数
short
Word
16位无符号整数
unsigned short
Integer,LongInt
32位有符号整数
int,long
Cardinal,LongWord/DWORD
32位无符号整数
unsigned long
Int6 ......
华为C/C++笔试题2 收藏
1. 某32位系统下, C++程序,请计算sizeof 的值
#include <stdio.h>
#include <malloc.h>
void Foo ( char str[100] )
{
printf("sizeof(str)=%d \n", sizeof(str) );//此处使用char *str与char str[100]是一样的,char str[100]不指明大小(char str[]) ......
1. 找错
#define MAX_SRM 256
DSN get_SRM_no()
{
static int SRM_no;
int I;
for(I=0;I<MAX_SRM;I++,SRM_no++)
{
SRM_no %= MAX_SRM;
......
linux 下 用c语言创建mysql数据库笔记(一)
-----仅为个人学习摘要,并不断更新中。。。。
在引用头文件时必须包含‘mysql.h’的头文件(必须是mysql.h的绝对地址,一般在mysql下的include目录下,仔细看看你的在哪里?*),
我是ubuntu9。04,在/usr/include/mysql/mysql ......