W3Sschool Tryit
在 w3school 網站上的網頁中常會有可以讓讀者 "邊學邊試的網頁" 連結.



進入 w3school 的 "邊學邊試" 頁面


MagicJackTing 發表在 痞客邦 留言(0) 人氣()

CSS Sample
快速參考


常見的 CSS(v1) selector 設定套用的次序如下:

<style type="text/css">
div { color: black ; ... } /* 1st level */
.nClass { color: green ; ... } /* +this 2nd level */
#nId { color: blue ; ... } /* +this 3rd level */
...
</style>
...
<div style="color: red; ... "><!-- /* +this 4th level */ -->

MagicJackTing 發表在 痞客邦 留言(0) 人氣()

[轉貼] GCC常用編譯參數 http://gtstudy.pixnet.net/blog/post/40505641
[來源] 小亮吉他教學&程式筆記


MagicJackTing 發表在 痞客邦 留言(0) 人氣()

這篇是從別人的部落格剪來轉貼的, 花了一點時間校對及重新編排版面.
雖然原 PO 文有點舊了 (2000年), 現在 (2015年) 原 PO 文網址已經連不到了, 還有一部份參數已經不存在了, 但是當新手面對現今的 GCC 參數和選項動則數以百計, 還有厚厚一疊手冊時, 不失為一個不錯的快速入門.
註: 原 PO 文二篇, 本篇為第二篇

MagicJackTing 發表在 痞客邦 留言(0) 人氣()

這篇是從別人的部落格剪來轉貼的, 花了一點時間校對及重新編排版面.
雖然原 PO 文有點舊了 (2000年), 現在 (2015年) 原 PO 文網址已經連不到了, 還有一部份參數已經不存在了, 但是當新手面對現今的 GCC 參數和選項動則數以百計, 還有厚厚一疊手冊時, 不失為一個不錯的快速入門.
註: 原 PO 文二篇, 本篇為第一篇

MagicJackTing 發表在 痞客邦 留言(0) 人氣()

Mem Map2
C 語言的變數有所謂的 storage class, 初學時對當中的差異並不是很容易弄清楚, 後來我把各種條件稍作整理, 於是有了下面的表格:



C 語言變數


條件/狀況
外部變數
(全域變數)
靜態變數
自動變數
(區域變數)
函數參數


大分類
全域變數
區域變數
Key Word

static
static
auto (可略)

定義/宣告註1位置
函數外部
函數內 (或者 {} 區塊內)
函數本體
變數名稱重複
編譯錯誤. 專案中所有全域變數名稱需唯一
  • 與同一區塊內的變數同名時, 編譯錯誤.
  • 與區塊外層變數同名時, 外層變數被遮蔽.

在外部檔案 (.c/.h) 中使用(或參考)
外部檔案中變數宣告的前面加上 extern 即可
外部檔案中無法使用(或參考)
在定義的區塊外即無法使用
函數區塊外即無法使用
可視範圍註2
scope
自定義位置 (不必需在檔案的最前面) 至檔案結束
函數內 (或者 {} 區塊內)
函數內
生命期註3
life-time
程式執行期間 (或永久)
函數內 (或者 {} 區塊內)
函數內
初值(未設初值時)
0 (因為是使用 .bss 區段的關係)
未知
編譯錯誤. 參數個數不一致註4
初值設定限制註5
及其執行時機
限制只能使用常數運算式
只執行一次, main() 執行前由 "可載入執行檔 ELF" (或二進位影像 binary image) 拷貝至正確之 .data 區段位址內
無限制, 任何運算式均可.
每一次進入函數或區塊後立即執行
無限制
呼叫前執行設定
預設使用之記憶體區段
無初值
.bss註6
stack註6
register 或 stack註6

有初值
.data註6
stack註6
register 或 stack註6


MagicJackTing 發表在 痞客邦 留言(5) 人氣()

下面範例中的 setStyleRule() 可以用來動態增加 stylesheet 中的項目(selector), applyClass() 則可以用來為物件刪除/附加新的 CSS Style Class (只能是 class).

<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="ext_style.js"></script>
<script type="text/javascript">
function fnInit() {
setStyleRule("", "#id1", "color:blue;");
}

window.addEventListener('load', fnInit);
</script>
</head>
<body>
<h1 id="id1">My Heading 1</h1>
<button type="button" onclick="document.getElementById('id1').style.color = 'red'">
Click Me!</button>
</body>
</html>

MagicJackTing 發表在 痞客邦 留言(0) 人氣()

List Style
前二天心裡有個念頭突然閃過, 於是用手機看了一下自己在部落格的 PO 文.
結果... 昏倒... 手機模式的 CSS Style 設定都沒有出現.
於是寫信給 客服, 客服的回信倒是蠻快的 :)
可是, 回信內容卻是令人十分的不滿意, 就只說 手機模式目前不能自定 CSS Style, 也沒有設定檔可以加. :(

MagicJackTing 發表在 痞客邦 留言(0) 人氣()

運算子優先權 (C 語言) Percedence Table




C 語言運算子優先權重表


運算子
Operator
說 明
Description
結合順序
Associativity
1
()
[]
->
.
++ --
Function call
Array subscripting
Element selection (of struct or union) through pointer
Element selection (of struct or union) by reference
increment/decrement (suffix) (註1)
左至右(註2)
2
!
~
++ --
+ -
*
&
(type)
sizeof
logic NOT
bitwise NOT
increment/decrement (prefix)
unary plus and minus
Indirection (dereference, right value)
Address-of (left value)
type cast
Size-of
右至左(註2)
3
* / %
Arithmetic multiplication, division, and remainder
左至右
4
+ -
Arithmetic addition, subtraction
左至右
5
<< >>
Bitwise left shift, right shift
左至右
6
< <=
> >=
Relational less than, not greater than
Relational greater than, not less than
左至右
7
== !=
Relational equal, not equal
左至右
8
&
Bitwise AND
左至右
9
^
Bitwise XOR
左至右
10
|
Bitwise OR
左至右
11
&&
Logical AND
左至右
12
||
Logical OR
左至右
13
?:
Ternary conditional
右至左
14
=
+= -=
*= /= %=
&= ^= |=
<<= >>=
Direct assignment
Assignment by sum, difference
Assignment by product, quotient, remainder
Assignment by bitwise AND, XOR, OR
Assignment by bitwise left shift, right shift
右至左
15
,
Comma
左至右


MagicJackTing 發表在 痞客邦 留言(6) 人氣()

以往寫網頁都是把 CSS Style 在 <head></head> 區段中載入, 今天發現在 <body></body> 區段中載入也是可以的.
另外如果不是要載入 CSS 檔, 而是要把 CSS Style 插入在 <body></body> 區段中, 則需要用 <div></div> 區段把 <style></style> 區段包住.

MagicJackTing 發表在 痞客邦 留言(0) 人氣()

以前以為 typedef 的功能可以用 #define 來完成, 用起來感覺功能也差不多, 例如:

typedef unsigned char bool; // 用這一行或者是下一行 二選一
//#define bool unsigned char

bool flag1, flag2;

MagicJackTing 發表在 痞客邦 留言(0) 人氣()

C 語言中 typedef 可以用來擴充 C 原有的資料型態. 通常我們會將某個資料型態或者將常用的資料型態組合給予一個比較直觀而易懂的別名. 定義別名之後我們就可以像使用原有的資料型態來宣告或定義變數一樣, 直接拿它來宣告或定義(註一, 註二)變數.

MagicJackTing 發表在 痞客邦 留言(7) 人氣()

Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。