C语言字符串拼接

C语言字符串拼接包含头文件:#include<stdio.h>函数体intsprintf(char*str,constchar*format,...);例子:intgpio_num=99;charPATH[64];sprintf(PATH,"/sys/class/gpio/gpio%d/value",gpio_num);intgpio_num=99;charstr[10]="asd";charPATH[64];sprintf(PATH,"welcom

包含头文件:
#include <stdio.h>

函数体

int sprintf(char *str, const char *format, ...);
只听到从架构师办公室传来架构君的声音:
明日巴陵道,秋山又几重。有谁来对上联或下联?

例子:

此代码由Java架构师必看网-架构君整理
int gpio_num = 99; char PATH[64]; sprintf(PATH,"/sys/class/gpio/gpio%d/value",gpio_num); int gpio_num = 99; char str[10] = "asd"; char PATH[64]; sprintf(PATH,"welcome,%s,hello,%d",str,gpio_num);
架构君码字不易,如需转载,请注明出处:https://javajgs.com/archives/209690
0
   

发表评论