1. 报错信息

error: incompatible types in assignment of ‘const char [5]’ to ‘char [9]’

2. 错误示例

3. 原因及解决

C语言数组在定义之后,不允许再次进行赋值,仅允许修改和读取操作,而且修改也只能逐个进行。

  1. 如果想对字符数组重新赋值,可以使用strcpy函数
#include <string.h>
#include <iostream>
int main() {char p[] = "11111111";strcpy(p,"22222");std::cout<<p<<std::endl;
}

  1. 如果想对整数数组进行赋值,可以使用memcpy函数
#include <string.h>
#include <iostream>
int main() {int a[] = {1,2,3};int b[] = {4,5,6,7};memcpy(a, b, sizeof(int)*4);
}

error: array type ‘char [x]‘ is not assignable相关推荐

  1. Array type xxx is not assignable

    问题 在 world_type.h里面的struct.species_t也是一个struct. struct world_t {unsigned int numSpecies;species_t sp ...

  2. error TS2322: Type ‘WritableComputedRef<string>‘ is not assignable to type ‘string‘ 解决方法

    前言 在 Vue3 + TypeScript + pinia 项目中,使用 get() set() 定义计算属性时,出现 '不能将类型"WritableComputedRef<stri ...

  3. Linux交叉编译问题strace解决 signalfd.c:15: xlat/sfd_flags.h:17: error: size of array 'type name' is negative

    产品不是很稳定,执行shell容易出现段错误,为了定位打算移植strace到嵌入式板子上,环境是MIPS平台,从github上下载的strace源码,编译ARM平台通过( ubuntu 12.04 交 ...

  4. error TS2322: Type {} is not assignable to type ‘IntrinsicAttributes IntrinsicClassAttributes

    具体build报错 src/components/columnSelectorC/index.tsx(159,7): error TS2322: Type '{ useDragHandle: true ...

  5. typescript error TS2322: Type ‘Timeout‘ is not assignable to type ‘number‘.

    源码 const timer:number = setTimeout(()=>{},1) 报错 typescript error TS2322: Type 'Timeout' is not as ...

  6. error: C2338: Type is not registered, please use the Q_DECLARE_METATYPE macro to make it known to Qt

    Qt系列文章目录 文章目录 Qt系列文章目录 前言 一.Q_DECLARE_METATYPE是什么? 示例代码 二.编译错误 三.问题解决 四.源码下载 五.运行效果 前言 一.Q_DECLARE_M ...

  7. 解决error: unknown type name ‘__u8’问题,认识__u8,__u16,__u32,__u64的大小及作用

    1.解决Linux error: unknown type name '__u8'问题: 内核提供的数据类型都在头文件<asm/types.h>声明,可以在程序中加上#include &l ...

  8. avisynth_c.h:825:3: error: unknown type name ‘HMODULE’

    avisynth_c.h:825:3: error: unknown type name 'HMODULE' In file included from input/avs.c:49:0: ./ext ...

  9. mpeg4ip.h:126: error: new declaration ‘char* strcasestr(const char*, const char*)’

    编译FAAC-1.28时遇到错误: mpeg4ip.h:126: error: new declaration 'char* strcasestr(const char*, const char*)' ...

最新文章

  1. 【node】express的www.js文件里面的process.env.PORT
  2. windows中安装Node.js-安装angular-cli
  3. 【Matlab】绘制3D 3维图
  4. Mac 删除应用卸载后无法正常移除的图标
  5. IOS的Alamofire5.4高版本上传图片
  6. Linux下Bluez的编程实现
  7. php开发支付宝支付密码忘记了怎么办_密码箱忘记密码怎么办?密码箱解锁方法大全...
  8. 多表关系介绍 mysql
  9. 使用Idea简单搭建springcloud项目
  10. 浅谈 NLP 细粒度情感分析(ABSA)
  11. 更改yum源配置后执行报错[Errno 14] PYCURL ERROR 22 - “The requested URL returned error: 404 Not Found”
  12. framework —— auth认证
  13. tomcat配置及遇到的问题
  14. 五子棋c语言代码光标,c语言写的鼠标操作的五子棋游戏,欢迎观赏!
  15. 调用百度万年历接口判断输入的日期是否是工作日
  16. 【Fusion】mosek.fusion基本模型
  17. phpQuery的用法
  18. c语言入门之项目2.3——利息计算器
  19. 我所理解的羽毛球运动(没有教练业余羽毛球如何让自己提高?)
  20. 论文阅读——TR-GAN: Topology Ranking GAN with Triplet Loss for Retinal Artery/Vein Classification

热门文章

  1. 融资租赁行业的小问题,喜相逢的大难题
  2. dfrobot红外激光测距传感器的精度,测量距离和应用场景
  3. java使用unicode过滤emoji表情
  4. 安卓开源项目周报0222
  5. Learning to Rank系列之概述
  6. csp怎么给线条描边_CSP优动漫PAINT中基本功能详细介绍
  7. 【Unity3D】如何打开外部 exe 程序
  8. python rm 条件_python版rm命令
  9. android studio signatures are inconsistent
  10. java虚拟机能自动处理 异常_对于非运行时异常,程序中一般可不做处理,由java虚拟机自动...