C/C++º¯Êý²ÎÊý,´«ÖµÓò´«Ö·!!!
/*
* File: main.cpp
* Author: Vicky
*
* Created on 2010Äê5ÔÂ8ÈÕ, ÏÂÎç2:47
*/
#include <iostream>
using namespace std;
void swap(int x, int y) {
cout << "x and y swap before : " << x << "\t" << y << endl;
int i = x;
x = y;
y = i;
cout << "x and y swap after : " << x << "\t" << y << endl;
}
void swap2(int * x, int * y) {
cout << "x and y swap before : " << *x << "\t" << *y << endl;
int * i = x;
x = y;
y = i;
cout << "x and y swap after : " << *x << "\t" << *y << endl;
}
/**
* ×¢Òâ,´Ë´¦·Ç&xÓë&y²¢·ÇµØÖ·,¶øÊǶÔÏóµÄ±ðÃû!!!
*/
void swap3(int &x, int &y) {
cout << "x and y swap before : " << x << "\t" << y << endl;
int i = x;
x = y;
y = i;
cout << "x and y swap after : " << x << "\t" << y << endl;
}
/**
* °´Ö·´«µÝ,´«µÝµÄ²ÎÊýÊǵØÖ·.
*/
void swap4(int * x, int * y) {
cout << "x and y swap before : " << *x << "\t" << *y << endl;
int i = *x;
*x = *y;
*y = i;
cout << "x and y swap after : " << *x << "\t" << *y << endl;
}
int main(int argc, char** argv) {
int x = 1;
int y = 9;
cout << "main function swap before : " << x << "\t" << y << endl;
swap(x, y);
cout << "main function swap after : " << x << "\t" << y << endl;
// ¿É½«,Ö÷º¯ÊýµÄxÓëy²¢Ã»Óн»»»,±íʾswapº¯Êý½»»»µÄ½ö½öÊÇxÓëyµÄ¸±±¾
cout << "---------" << endl;
int * px = new int(1);
int * py = new int(9);
cout << "main function swap before : " << *px << "\t" << *py << endl;
swap2(px, py);
cout << "main function swap after : " << *px << "\t" << *py << en
Ïà¹ØÎĵµ£º
ÔÚ×öSDLÖÁAndroidµÄÒÆֲʱ£¬¼üÅÌʼþÊÇÄÜÕý³£²¶»ñµ½£¬¿´ÁËSLDµÄÔ´Â룬·¢ÏÖÓõÄdeviceÊÇ /dev/tty0£¬µ«ÊÇÊó±ê½ÐÊDz»Äܳɹ¦²¶»ñ£¬×ÜÊǵõ½ 0£¬ÔËÐÐÃüÁî²é¿´devicesʱ£¬ÏÔʾÈçÏ£º
# cat /proc/bus/input/devices
cat /proc/bus/input/devices
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="qwerty ......
access£¨ÅжÏÊÇ·ñ¾ßÓдæÈ¡ÎļþµÄȨÏÞ£©
¡¡¡¡Ïà¹Øº¯Êý stat£¬open£¬chmod£¬chown£¬setuid£¬setgid
¡¡¡¡±íÍ·Îļþ #include<unistd.h>
¡¡¡¡¶¨Ò庯Êý int access(const char * pathname,int mode);
¡¡¡¡º¯Êý˵Ã÷ access()»á¼ì²éÊÇ·ñ¿ÉÒÔ¶Á/дijһÒÑ´æÔÚµÄÎļþ¡£²ÎÊýmodeÓм¸ÖÖÇé¿ö×éºÏ£¬R_OK ......
1.ÕâÑùµÄ³õʼ»¯ÓÐʲôÎÊÌ⣿char *p = malloc(10); ±àÒëÆ÷Ìáʾ“·Ç·¨³õʼʽ” ÔÆÔÆ¡£
´ð:Õâ¸öÉùÃ÷ÊǾ²Ì¬»ò·Ç¾Ö
²¿±äÁ¿Â𣿺¯Êýµ÷ÓÃÖ»ÄܳöÏÖÔÚ×Ô¶¯±äÁ¿(¼´¾Ö²¿·Ç¾²Ì¬±äÁ¿) µÄ³õʼʽÖС£
ÒòΪ¾²Ì¬±äÁ¿µÄµØÖ·±ØÐëÔÚ±àÒëµÄ¹ý³ÌÖоÍÈ·¶¨ÏÂÀ´¶ømalloc()Éê
ÇëµÄÄÚ´æµØÖ·ÊÇÔÚÔËÐÐʱȷ¶¨µÄ¡£
2. *p++ ×ÔÔöp »¹ÊÇp ËùÖ ......
http://uncrustify.sourceforge.net/
Ident code, aligning on parens, assignments, etc
Align on '=' and variable definitions
Align structure initializers
Align #define stuff
Align backslash-newline stuff
Reformat comments (a little bit)
Fix inter-character spacing
Add or remove parens on return ......
CAPTION: ¹ØÓÚC/C++ÖÐÄÚ´æ¿Õ¼äµÄ»®·Ö
AUTHOR: aIsland Õª×ÔÖйúITʵÑéÊÒ
DATE: 2010-05-30
E-MAIL: aIsland@live.cn
QQ: 418662213
P.S.
1.Bolanlan|ËæÐÄhigh|aIsland Èý¸öÍøÃû¾ùΪ±¾ÈË
2.ÉùÃ÷aIsland ËùÊÕ¼µÄËùÓÐÎÄÕÂÆäÖø×÷Ȩ¶¼ÊôÓÚÔ´´×÷Õß
  ......