请问小甲鱼第十讲 复杂数据类型04指针和数组为什么编译错误啊
#include <iostream>int main()
{
const unsigned short ITEMS = 5;
int intArray = {1, 2, 3, 4, 5};
char charArray = {'F', 'i', 's', 'h', 'C'};
int *intPtr = intArray;
char *charPtr = charArray;
std::cout << "整型数组输出: " << '\n';
for( int i=0; i < ITEMS; i++ )
{
std::cout << *intPtr << " at " <<reinterpret_cast<unsigned long> (intPtr) << '\n';
intPtr++;
}
std::cout << "字符型数组输出: " << '\n';
for( int i=0; i < ITEMS; i++ )
{
std::cout << *charPtr << " at " <<reinterpret_cast<unsigned long>(charPtr) << '\n';
charPtr++;
}
return 0;
}vc6.0提示
Deleting intermediate files and output files for project 'a - Win32 Debug'.
--------------------Configuration: a - Win32 Debug--------------------
Compiling...
a.cpp
c:\documents and settings\administrator\a.cpp(21) : error C2374: 'i' : redefinition; multiple initialization
c:\documents and settings\administrator\a.cpp(14) : see declaration of 'i'
我看小甲鱼的视频为什么可以编译通过啊,这里的i有多重初始化是不是
错误是重新定义了i在前面定义过了不允许重新定义…… computerwhiz 发表于 2013-6-16 21:34 static/image/common/back.gif
错误是重新定义了i在前面定义过了不允许重新定义……
为什么小甲鱼的编辑器可以通过啊,应该如何修改啊 无回帖,不论坛,这才是人道。 14 与21 都 有 int i =0;
21可以去掉 int
页:
[1]