small C++ error :(

#include <iostream>

using namespace std;

int main()
{

int postOffice[4] = (1);



}



1>c:\users\yassar\documents\visual studio 2008\projects\larrays\larrays\larrays.cpp(8) : error C2440: 'initializing' : cannot convert from 'int' to 'int [4]'


i dont understand why i get this error massage

thanks in advance
Er. That's exactly what it says on the tin. You're trying to assign one integer to an array of integers, which doesn't work in C++.

-Albatross
try this
1
2
3
4
5
6
7



int postOffice[4] = {1,0};

array will have 1, 0 , 0 , 0
Last edited on
Topic archived. No new replies allowed.