Main Content

strcpy

字符串赋值

描述

示例

str1 = str2 将字符串 str1 赋给字符串 str2

示例

strcpy(str1,str2) 是执行 str1 = str2 的另一种方式。

注意

仅在使用 C 语言作为动作语言的 Stateflow® 图中支持运算符 strcpy

示例

全部展开

将字符串数据赋给 str1str2

str1 = 'So Long';
str2 = "Farewell";

Stateflow chart that uses the strcpy operator in a state.

在使用 C 语言作为动作语言的图中,您也可以使用 strcpy 进行字符串数据赋值。

strcpy(str3,'Auf Wiedersehen');
strcpy(str4,"Adieu");

Stateflow chart that uses the strcpy operator in a state.

提示

  • 源参量和目标参量必须为不同的符号。

  • 用单引号或双引号将文字字符串引起来。

版本历史记录

在 R2018b 中推出