※ 引述《UNARY.bbs@bbs.cse.ttu.edu.tw (Rootkit Researcher)》之銘言:
> ※ 引述《ooa.bbs@bbs.ntu.edu.tw (歐弟)》之銘言:
> > // char str[] = "string"; // (1)
> > 在這一段中
> > 記憶體配置 char str[] 是在堆疊中
> > 要allocate記憶體在heap 要呼叫 malloc 才行
> 因為前面一篇是說
> 「會在 stack 上 allocate 一塊大小為 strlen("string") 的空間」
> 我要問的是
> 既然包含結尾 0,那堆疊空間不是應該就得配置 strlen() 還要 +1 嗎?
> 這邊我並無對 heap 和 malloc 的疑問啊 @.@
打太快少寫 + 1 而已,
不必想太多。
--
Name: Tseng, Ling-hua E-mail Address: uranus@it.muds.net
School: National Tsing Hua University Department: Computer Science
Interesting: C++, Compiler, PL/PD, OS, VM, Large-scale software design
Researching: Undecided
Homepage: https://it.muds.net/~uranus
--
╔═══╗ ┼────────────────────────╮
║狂狷 ║ │* Origin:[ 狂 狷 年 少 ] whshs.cs.nccu.edu.tw ╰─╮
║ 年少║ ┼╮ < IP:140.119.164.252 > ╰─╮
╚╦═╦╝ ╰ * From:61-230-216-250.dynamic.hinet.net
─╨─╨─ KGBBS ─ ◎ 遨翔"BBS"的狂狷不馴;屬於年少的輕狂色彩 ◎