本文介绍了使用变量指定字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码段都打算使用变量x来指定字符串hello。验证它们是否正确。



1. char x [256] =hello;

2. char x [256]; x =你好;

3. char * x =你好;

4. char * x; x =你好;

5. char x [256] = {'h','e','l','l','o'};

The following code segments all intend to use variable x to specify a string "hello". Verify if they are correct.

1. char x[256]="hello";
2. char x[256]; x="hello";
3. char *x="hello";
4. char *x; x="hello";
5. char x[256]={’h’, ’e’, ’l’, ’l’, ’o’};

推荐答案


这篇关于使用变量指定字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 23:10
查看更多