full.c

来自「linux下的C语言开发」· C语言 代码 · 共 37 行

C
37
字号
/*-*//******************************************************** * Name:						* *	concat						* *							* * Purpose:						* *	Demonstrates how to put strings together using	* *	strcat.						* *							* * Usage:						* * 	Run it and see my full name.			* *							* * Notes:						* *	Don't try to pronounce the last name.		* ********************************************************//*+*/#include <string.h>#include <stdio.h>char first[100];        /* first name */char last[100];         /* last name */char full_name[200];    /* full version of first and last name */int main(){    strcpy(first, "Steve");       /* Initialize first name */    strcpy(last, "Oualline");     /* Initialize last name */    strcpy(full_name, first);     /* full = "Steve" */    /* Note: strcat not strcpy */    strcat(full_name, " ");       /* full = "Steve " */    strcat(full_name, last);      /* full = "Steve Oualline" */    printf("The full name is %s\n", full_name);    return (0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?