容易搞混
int main(int argc , char *argv[])
{
char* name = "Victor Hugo";
char str[10] = "aaa";
printf("\n%d %d\n" , sizeof(name) , sizeof(*name) );
printf("%s\n" , typeid(name).name());
printf("...
分类:
编程语言 时间:
2015-04-07 12:10:49
阅读次数:
148
说白了c++中的引用就是指针。。至少底层实现是这样。。
一个例子说明。。一下
#include
int main(int argc , char *argv[])
{
int a = 9;
int *b = &a;
int &c = a;
++c;
*b += 2;
return 0;
}
1: #include
2:
3: int main(int argc...
分类:
编程语言 时间:
2015-04-07 12:00:19
阅读次数:
163
#include
using namespace std;
int main(int argc, char* argv[])
{
char* str1 = "hello";
char* str2 = "china";
char* str3 = NULL;
str3 = new char[strlen(str1) + strlen(str2) + 1];
str3[0] = '\n...
分类:
其他好文 时间:
2015-04-06 18:50:09
阅读次数:
110
一个简单的EGE程序:#include "graphics.h" //EGE库的头文件 int main(int argc, char** argv) { initgraph(320,240); //初始化绘图窗口 outtextxy(20,120,"Aloha Wor...
分类:
编程语言 时间:
2015-04-06 11:15:50
阅读次数:
159
参考书籍:C++ Primer 5th
代码下载地址:https://github.com/alivebao/StudyofCPlusPlus
1. Hello World
学写代码的第一个程序-Hello World
Code:
int _tmain(int argc, _TCHAR* argv[])
{
std::cout<<"Hello World"<<std:...
分类:
编程语言 时间:
2015-04-06 08:53:28
阅读次数:
128
编译不能通过
#include "iostream"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
char *p= "hello" ; //不是把一个字符串赋给了一个字符型的指针,而是把一个字符型的指针指向了字符串的首地址。
strcpy(p,"hel");
cout << p << endl;
return...
分类:
其他好文 时间:
2015-04-05 23:37:28
阅读次数:
334
本周学习了孟宁老师的《Linux内核分析》,按照课程要求,做实验如下:首先使用gdb跟踪一个系统调用,我们选择上周实验所写的代码,修改这两段代码成两个系统调用,放入根文件系统中,作为本次实验将要观察的系统调用。修改代码如下:1) c实现的系统调用int mkdir_c(int argc, char ...
分类:
其他好文 时间:
2015-04-05 20:21:50
阅读次数:
142
一道经典的 省市区题目 字典与数组的循环嵌套 对于初学OC的朋友理解字典与数组有很大的帮助 结构图 :#import int main(int argc, const char * argv[]) { //第一版本// NSString * path = @"/Users/bruce_lin/...
分类:
移动开发 时间:
2015-04-05 11:48:43
阅读次数:
301
问题:
杨辉三角
#include
#include
int c(int x, int y);
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) ...
分类:
其他好文 时间:
2015-04-04 12:19:16
阅读次数:
150
通过使用GetFileAttributes 或者GetFileAttributes函数能够获得文件的属性,CreateFile和SetFileAttributes函数可以设置文件的属性。
例子:
#include
#include
#include
#include
void _tmain(int argc, TCHAR* argv[])
{
WIN32_FIND_DA...
分类:
编程语言 时间:
2015-04-03 11:24:45
阅读次数:
169