[問題] memset的使用
我想請問一下memset的問題 假設我有類似下面這段code
理論上應該都不會print出東西
可是實際上確卻 請問是我哪邊弄錯了嗎?
謝謝
void test(struct contract *temp)
{
memset(temp->testno, NULL, sizeof(temp->testno)); //char testno[3][80]
}
void main()
{
struct contract temp;
test(&temp);
for(int i = 0; i < 3; i++)
if(strcmp(temp.testno[i], NULL))
printf("testno != NULL");
}
--
★
╔╮ ╭═╦╮╭═╦╗╮ ╮╔══╮╭═╦╮╮ ╔╮╔══╮╭══╮
╠╣ ╠═╬╣╭╬╩╯╰╦╦╯╠═╦╮║ ╠╣║║╠╣╠╣ ╰═╦╮
╠╣ ╭║ ╠╣║╰╔╗ ╠╣ ║ ╠╣║ ╠╣║╰╠╣║╰╔╗║ ╠╣
╰╩═╯╰ ╰╝╚═╩╯ ╰╝ ╚═╩╯╰═╩╯╰ ╰╝╚═╩╯╰═╩╯
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.211.0.80
推
04/19 15:45, , 1F
04/19 15:45, 1F
推
04/19 15:45, , 2F
04/19 15:45, 2F
→
04/19 16:09, , 3F
04/19 16:09, 3F