I fuxed the other code with the currection by CormedBee.
Code:
#include <iostream>
#include <stdlib.h>
using namespace std ;
int main( int argc, char* argv[] )
{
int marks[--argc];
int total = 0 ;
for ( int i = 0; i < argc; i++)
{
marks[i] = atoi(argv[i+1]) ;
}
}
U may wish 2 do someting like this
Code:
#include <iostream>
#include <new>
int main( int argc, char** argv )
{
try
{
int *marks = new int[--argc];
int total = 0 ;
for ( int i = 0; i < argc; i++)
{
marks[i] = atoi(*(++argv)) ;
}
delete[] marks;
return 0;
} catch(std::bad_alloc e)
{
return -1;
}
}