int array not working

 

int c[];

c[1]=1;

print(c[1]);

it prints c[1] as being zero.

 

Don't double post please ! I removed your other post.

You need to use ArrayResize() when you declare a dynamic array.

 
Alain Verleyen:

Don't double post please ! I removed your other post.

You need to use ArrayResize() when you declare a dynamic array.

sorry. i made it work with declaring a number in [] ;
 
Cristi Margaritescu:

int c[];

c[1]=1;

print(c[1]);

it prints c[1] as being zero.

  1. Use Alt-S for code please!
  2. int c[] creates an array with size 0 - you can't assign any value (so far)
  3. int c[1] creates an empty array with size 1!
  4. In the editor press F1 and search for ArrayResize() - start reading!
 
thanks for the quick replies.
Reason: