網頁

2013年10月20日 星期日

C++ memory & stack-allocated for local variable

Last Update: 2013/10/20 12:22+08
Type: note


Intro

Local Variable 的 memory 位置 和 return value
主要是要測試 class 在 function return 時 的問題
但用 int 比較方便解釋, 所以這邊用 int 作測 試
int get1(){ int rs = 1; printf("%d : %d\n", &rs, rs); return rs;}
int* get2(){ int rs = 2; printf("%d : %d\n", &rs, rs); return &rs;}
int& get3(){ int rs = 3; printf("%d : %d\n", &rs, rs); return rs;}
int& get4(){ int *rs = new int(4); printf("%d : %d\n", rs, *rs); return *rs;}


2013年10月19日 星期六

C++ - use of reference(&) or pointer(*) in function parameters

Last Update: 2014/12/20 14:19+08
Type: Note


Intro


如何傳遞參數
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <vector>
#include <map>

class Vec2D {
public:
 int x, y;
};


2013年10月17日 星期四

Online Tool

Last Update: 20131018 11:37+08
Type: note



Photo Online Editor

像Photoshop, 但功能少很多, 夠用就好


Ziin.pl

檔案(圖檔) 轉換工具


syntax highlighting

程式語法的 highlighting