c/c++类型
1.分类
内部类型 和用户定义类型
2.
整形:bool ,字符型,整形
true 1 flase 0
非零 true 零 flase
非空指针 true 空指针 flase
char ,wchar_t
(unsigned signed)
int short int long int (unsigned signed)
3.
enum 类型 (enum 是关键字 ,如同 class )
enum {}
enum flag{a=1,b=100};
flag f1=flag(101);//显示转换为枚举
枚举符的范围 【0--2^k-1】
【-2^k--2^k-1】
sizeof (flag)==sizeof(int)==sizeof(bool);
枚举类型可以转换为 整形
3.声明 和定义的区别
extern int error_code;
int get_age();
int error_code=3;
int get_age()
{
}
描述符 基础类型 声明符号 初始式
声明符=名字+声明运算符
*
[]
()
&
* const
4.作用域
函数,类,名字空间,全局
全局 局部静态 名字空间 以0 初始化
局部变量 堆变量
静态对象:全局 局部静态 名字空间
自动对象:局部变量
直接控制对象:堆上的变量
5.左值
int a=3;
&a 是个右值
int &b=a//引用一个左值
const int &c=a//
const int &d=4;//const 引用 可以是个右值
const int * a1=0;
int const * const & b=&a1;
const int*
int*
const int &
相关文档:
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
#include<windows.h>
#include<malloc.h>
#include<math.h>
typedef struct worker
{
int num; //编号
char name[15]; //姓名
char zhicheng[15];& ......
先前在测试mysql connect c++接口的时候运行其官方提供的例子
21.5.5.6. MySQL Connector/C++ Complete Example 2
The following code shows a complete example of how to use MySQL Connector/C++:
/* Copyright 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify ......
格式输出:
printf(格式控制, 输出表列);
%d 十进制数 %md m为指定的宽度 若数据位数小于m,则左端补以空格;若大于m,则按实际位数输出
%ld 长整型数据 %mld 指定字段宽度
%o 八进制整数形式 %mo
%x 十六进制整数形式 %mx
%u unsigned型数据,它也可用%o或%x格式输出
%c 一个字符 ......
先是内核驱动程序:
#include <linux/module.h>//具体的头文件位置为/opt/FriendlyARM/mini2440/linux-2.6.29/include/linux/*.h
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/poll.h>
#include <l ......