C语言完美演绎7-15

/* 范例:7-15 */

#include <string.h>

#include <stdio.h>

void main(void)

{

/* 定义参数dest的字符数组destination25 */

char destination25;

/* 定义参数scr的字符指针scr1、scr2、scr3 */

char *scr1 = "tiger" , *scr2 =" is", *scr3 = " braveaaaaa" ;

char *a,*b;

strcpy(destination, scr1);

printf("%s\n", destination);

/* 将参数scr2中的字符串加到参数destination的字符串之后 */

a = strcat(destination, scr2);

printf("%s\n", destination);

printf("a=%s (void*)a=%u\n", a,sizeof(destination));

/* 将参数scr3的字符串前6个字符加到参数destination的字符串之后 */

b = strncat(destination, scr3,6);

printf("%s\n", b);

getchar();}

}

程序执行结果:

tiger

tiger is

a=tiger is (void*)a=25

tiger is brave

相关推荐
LDR0062 天前
Type-C 快充全面升级!LDR6601 赋能个人护理便携电机,重塑剃须刀 / 理发器新体验
c语言·开发语言
Luminous.2 天前
C语言--day30
c语言·开发语言
玖玥拾2 天前
C/C++ 数据结构(七)栈、容器适配器
c语言·数据结构·c++··容器适配器
謓泽2 天前
C语言不是语法,是通往机器的地图。
c语言·开发语言
不会C语言的男孩2 天前
Linux 系统编程 · 第 8 章:进程基础
linux·c语言
2601_951643882 天前
C语言长文整理,关键字和数据类型
c语言·数据类型·关键字·嵌入式开发·格式化输出
m0_547486663 天前
《C#语言程序设计与实践》 全套PPT课件
c语言·c#·c语言程序设计
✎ ﹏梦醒͜ღ҉繁华落℘3 天前
编程基础 --高内聚,低耦合
c语言·单片机
QK_003 天前
C语言 static 关键字三大作用
c语言·开发语言
隔窗听雨眠3 天前
C语言函数递归从入门到精通(下):性能优化与工程实践
c语言·算法·性能优化