Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accessing arrays

Status
Not open for further replies.

Bucknut98

Technical User
Joined
Mar 11, 2006
Messages
2
Location
US
hello,

had trouble compiling this program and don't know whats the matter...........

Code:
#include<stdio.h>
#define NMAX 100

double NextB( double B[], int *firstK, int *lastK, int n);

int main() {

	double B[NMAX+1];
	double maxB;
	int n, firstK, lastK,
	B[0] = 0.5; 

        return 0;
}

and the compiler gives these errors:
it seems that i cant assign values to array elements B[0]

Code:
Cpp1.cpp(11) : error C2466: cannot allocate an array of constant size 0

Cpp1.cpp(11) : error C2371: 'B' : redefinition; different basic types

Cpp1.cpp(8) : see declaration of 'B'

Cpp1.cpp(11) : error C2440: 'initializing' : cannot convert from 'const double' to 'int []'
        There are no conversions to array types, although there are conversions to references or pointers to arrays
Error executing cl.exe.
 
> int n, firstK, lastK,
Make that last , a ;


--
 
Status
Not open for further replies.

Similar threads

  • Locked
  • Question Question
Replies
5
Views
307
  • Locked
  • Question Question
Replies
1
Views
300
Replies
1
Views
223
Replies
6
Views
304

Part and Inventory Search

Sponsor

Back
Top