c语言字符数组储存的形式,C语言字符数组储存形式问题

这篇博客主要讨论了一个C语言编程中的常见错误,包括未声明的标识符's2'、'str1'和's1',以及在类型转换中遇到的问题。代码试图创建字符数组和指针数组,并进行初始化,但存在语法错误和类型不匹配。错误提示显示了需要解决的语法和声明问题。
摘要由CSDN通过智能技术生成

#include#define M 5#define N 13int main(void){ char *s1="abc",*s2="wxyz",*s3="ijklmn"; char str1[M][N]={"c","c "visual BASIC,"Java","Ada

#include#define M 5#define N 13int main(void){ char *s1="abc",*s2="wxyz",*s3="ijklmn"; char str1[M][N]={"c","c "visual BASIC,"Java","Ada"}; char *str2[M]={s2,str1[2],s1,"ijklm"}; char **str3=&s2; int i; printf("

"); printf("&s1=%ld,&s2=%ld,&s3=%ld

",&s1,&s2,&s3); printf("

"); for(i=0;i<5;i ) printf("&str1[%d]=%ld:strl[%d]=%s

",i,&str1[i],i,strl[i]); printf("

");}错误字符串储存形式未解.cppE:C题好题未解题字符串储存形式未解.cpp(7) : error C2061: syntax error : identifier 'visual'E:C题好题未解题字符串储存形式未解.cpp(7) : warning C4508: 'main' : function should return a value; 'void' return type assumedE:C题好题未解题字符串储存形式未解.cpp(8) : error C2065: 's2' : undeclared identifierE:C题好题未解题字符串储存形式未解.cpp(8) : error C2440: 'initializing' : cannot convert from 'int' to 'char *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style castE:C题好题未解题字符串储存形式未解.cpp(8) : error C2065: 'str1' : undeclared identifierE:C题好题未解题字符串储存形式未解.cpp(8) : error C2109: subscript requires array or pointer typeE:C题好题未解题字符串储存形式未解.cpp(8) : error C2440: 'initializing' : cannot convert from 'int' to 'char *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style castE:C题好题未解题字符串储存形式未解.cpp(8) : error C2065: 's1' : undeclared identifierE:C题好题未解题字符串储存形式未解.cpp(8) : error C2440: 'initializing' : cannot convert from 'int' to 'char *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style castE:C题好题未解题字符串储存形式未解.cpp(9) : error C2440: 'initializing' : cannot convert from 'int *' to 'char ** ' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castE:C题好题未解题字符串储存形式未解.cpp(11) : error C2501: 'printf' : missing storage-class or type sp 写不下了 请更正后告诉我

展开

全部

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值