close

1. Declaration may not appear after executable statement in block

根據 ANSI C C90 standard 宣告變數的地方需要在執行任何code 之前

否則Keil 或者 Renesas CS+ IDE會產生error

 

2. 使用memcpy function in C/CPP

需#include <string.h>

使用方法:

// Copies "numBytes" bytes from address "from" to address "to"
void * memcpy(void *to, const void *from, size_t numBytes)

與strcpy的差異

strcpy stops when it encounters a NULL, memcpy does not. You do not see the effect here, as %sin printf also stops at NULL.

 

 

Reference:

http://www.keil.com/support/docs/3677.htm

https://www.geeksforgeeks.org/memcpy-in-cc/

https://stackoverflow.com/questions/2898364/strcpy-vs-memcpy

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 紅線 的頭像
    紅線

    紅線的生存日誌

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