You don't want the compiler to pretend that a string is an int, you want to actually take the int represented by the string and use it as an int. To do this you need to do a real conversion:
Code:
// With atoi
#include <stdlib.h>
...
int i = atoi ( argv[1] );
Code:
// With strtol because atoi sucks
#include <cstdlib>
...
int i = static_cast<int> ( strtol ( argv[1], 0, 0 );
Code:
// With stringstreams because they're cool :)
#include <sstream>
...
stringstream ss ( argv[1] );
int i;
ss>> i;
Or you could do it manually, but that's tricky and I don't recommend it unless you're in learning mode.
>int iArray[ /* Something */ ] = {0};
This isn't legal C++. You would be declaring an array with a non-constant size. While such a feature is a common extension, it isn't standard. You'll need to either declare a dynamic array:
Code:
// Assuming i was suitably initialized
int *iArray = new int[i];
Or use a standard vector:
Code:
#include <vector>
...
// Assuming i was suitably initialized
vector<int> iArray ( i );
[edit]
I'm officially embarrassed...
[/edit]