我是C++新手。我通常用C#编程,所以我遇到了数组和循环的麻烦。当我尝试使用一个循环来打印动态数组的内容,它说,损坏的请求的区域......比如我会给它认识到与阵列的内容使用的条件,但不打印的它里面的内容:没有打印出阵列C++
// Array.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
void main()
{
int size=3;
int *p;
int myarray[10];
myarray[3]=4;
p=new int[size];
p[2]=3;
if(myarray[3]==4){
cout << myarray[3] +"/n";
cout << "Why?";
}
else
cout << "Not equal " << endl;
cin.get();
delete [] p;
}
''/ n“'也应该是''\ n”' – sfstewman
和'\ n',除非OP真的很想'/ n'。 – SuperSaiyan
真的,谢谢:) – Blood