conflicting declaration ‘int a[4]={1,2,3,4}'
时间: 2023-11-19 21:26:50 浏览: 131
Qt5.12 屏幕录制软件 源码 适配中标麒麟、银河麒麟等国产系统
This error occurs when there are multiple declarations for the same variable or array with different initializations. In this case, the variable or array 'a' is declared twice with conflicting initializations.
To fix this error, remove one of the declarations or make sure that they have the same initialization values. For example:
int a[4] = {1, 2, 3, 4}; // correct initialization
int a[4] = {5, 6, 7, 8}; // conflicting initialization
or
int a[4]; // declare array
a[0] = 1;
a[1] = 2;
a[2] = 3;
a[3] = 4; // initialize array
Note that the second method requires separate initialization statements for each element in the array.
阅读全文