Khabs
Khabs

Reputation: 11

Making argv an integer array

When we define the parameter's of the main function body how come it cannot be defined as an integer array or can it?

If is can, how would I assign an integer value out of there into a variable.

Upvotes: 0

Views: 50

Answers (1)

krzaq
krzaq

Reputation: 16421

The standard about main:

N4140, § 3.6.1 [basic.start.main]/2

It shall have a declared return type of type int, but otherwise its type is implementation-defined.

So an implementation can offer int main(int argc, int argv[]). But I know of none that do, so you'd have to write your own. It's far easier to convert the strings to integers.

Upvotes: 4

Related Questions