※ 引述《MoseHas (非主流摩斯) (′‧ω‧‵)》之銘言:
: scanf("%d%s%lf",&account,name,&balance);
: //編按:scanf format: &account, &balance to find its memory address
: //I rarely use %s to get a string, so i cannot understand why here is name
: //instead of &name...
補充
我知道為什麼是name而不是&name了
如果是&name的話,代表的是陣列的第一個位置
也就是name[0]
試想把一個字串存在空間大小只能放一個字元的情況
嗯...
為什麼我這麼笨現在才想到= =
所以%s一定是放近name裡面,不用加index或者是[ ]
--
◢▅▇◣▉ ◣ ﹨ ∥∥ ∕
▉ ◥ ▊★◣▂▊ ◢◤ ◥▇▆▅▆▇◤ ╲◢‥‥◥╱
◥◣ ◤ ▊▊▊ ◥▍◢◤▉▅◣◢▆◣ ▊ ══'╴‥╴'══Craig
◢ ◥◣ ▋▋ ▇◤▌◣ ▊ ▉ ▊ ▉ ▋ ══' / '══
◣ █ ▋▍▋ ▎ ◥◣ ◥▌◥▆◤ ▋ ══'﹏﹏﹏'══
◥▂◤ ◤◤▌ ◥ ◥ ◥ ◥ ◢◣ ◢◣ ψcafelife
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.227.186.249