array size using pointer notation??

Is there a way to declare the size of an array using pointer notation without the square brackets that I used here?

const int SIZE = 100;
int myarray[SIZE];
No.
What are you talking about exactly?

You can declare dynamically allocated arrays like this:
1
2
3
4
5
6
int arrayLength;

cout << "Enter array length: ";
cin >> arrayLength;

int* anArray = new int[arrayLength];


More on dynamically allocated objects:
http://www.cplusplus.com/doc/tutorial/dynamic/
If you don't want to use the square brackets you can use the C dynamic allocation:
int *myarray = (int*) malloc ( size*sizeof(int) );
Topic archived. No new replies allowed.