- 字符操作
菜鸟教程-C语言字符操作
strcpy(config.stassid, WiFi.SSID().c_str());字符串复制 - 回调函数
看看来自Stack Overflow某位大神简洁明了的表述:A "callback" is any function that is called by another function which takes the first function as a parameter。 也就是说,函数 F1 调用函数 F2 的时候,函数 F1 通过参数给 函数 F2 传递了另外一个函数 F3 的指针,在函数 F2 执行的过程中,函数F2 调用了函数 F3,这个动作就叫做回调(Callback),而先被当做指针传入、后面又被回调的函数 F3 就是回调函数。
维基百科的对回调(Callback)的解析:In computer programming, a callback is any executable code that is passed as an argument to other code, which is expected to call back (execute) the argument at a given time. This execution may be immediate as in a synchronous callback, or it might happen at a later time as in an asynchronous callback. 也就是说,把一段可执行的代码像参数传递那样传给其他代码,而这段代码会在某个时刻被调用执行,这就叫做回调。如果代码立即被执行就称为同步回调,如果在之后晚点的某个时间再执行,则称之为异步回调
例如注册回调函数,也就是所谓的库函数
/* 注册回调函数 */
int ny_register_callback(int (*callback)())
{
if (callback == NULL)
{
return 0;
}
callback();
return 1;
}
回调函数,也是自己要写代码逻辑的函数
fun2()
{
printf(" this is function1!\n");
}
应用函数
int main()
{
ny_register_callback(fun2);
}