2012年12月29日

二维指针,传地址

摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 /* 5 值传递,地址传递,引用传递 6 */ 7 void find1(char array[], char search, char **pa) 8 { 9 //等价于, array = str, search = p, pa = &pc; 10 11 **pa = 'c';12 13 }14 15 int main( )16 {17 char str[1000], p[1000];18 while( scanf("%s%s",& 阅读全文

posted @ 2012-12-29 00:37 more think, more gains 阅读(176) 评论(0) 推荐(0) 编辑

2012年12月28日

彻底搞定C语言指针详解 --- (转载)

摘要: 1.语言中变量的实质要理解C指针,我认为一定要理解C中“变量”的存储实质, 所以我就从“变量”这个东西开始讲起吧!先来理解理解内存空间吧!请看下图:内存地址→ 6 7 8 9 10 11 12 13-----------------------------------------------------------------。。。 | | | | | | | |.。------------------------------- ----------------------------------如图所示,... 阅读全文

posted @ 2012-12-28 22:02 more think, more gains 阅读(247) 评论(0) 推荐(0) 编辑

2012年10月18日

静态成员

摘要: 静态成员(来自百度百科) 在c++类中声明成员时可以加上static关键字,这样声明的成员就叫做静态成员(包括数据成员和成员函数)。例如: class test{ public: test(){} ~test(){} public: //静态成员函数 static int getCount(){ return m_nCount; } private: //静态数据成员 static int m_nCount; }; int test::m_nCount=0; 静态数据成员和普通数据成员区别较大,体现在下面几点: (1)普通数据成员属于类的一个具体的对象,只有对... 阅读全文

posted @ 2012-10-18 20:42 more think, more gains 阅读(162) 评论(0) 推荐(0) 编辑

一直被我忽视的宏

摘要: #include <stdio.h>#define Max(x,y) (x) >= (y) ? (x) : (y) //调用了两次get#define max(x,y) ( { typeof(x) _x = x; typeof(y) _y = y; _x > _y ? _x : _y;} ) //只调用一次get函数 #define SetName(name) T_##name #define C(x) #x/*定义单行宏:主要有以下三种用法. 1) 前加##或后加##,将标记作为一个合法的标识符的一部分.注意,不是字符串.多用于多行的宏定义中.例如:#define A 阅读全文

posted @ 2012-10-18 20:28 more think, more gains 阅读(210) 评论(0) 推荐(0) 编辑

win32 Application hello,world

摘要: hello.cpp#include <windows.h>//#include "resource.h"#include "Hello.h"HINSTANCE _hInst;HWND _hWnd;char _szAppName[ ] = "AC梦";char _szTitle[ ] = "努力加油";int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR IpCmdLine,int nCmdShow){ MSG ms 阅读全文

posted @ 2012-10-18 09:08 more think, more gains 阅读(257) 评论(0) 推荐(1) 编辑

导航