0
点赞
收藏
分享

微信扫一扫

strncpy(buff,src,n);

爱薇Ivy趣闻 2023-05-22 阅读 72


#include "stdafx.h"
#include <string.h>

int main(int argc, char* argv[])
{
	char *src="qwert";
	char buff[256];
	int n=2;
	strncpy(buff,src,n);
	buff[n]='\0';
	printf("%s,%d\n",buff,strlen(buff));
	return 0;
}



举报

相关推荐

0 条评论