Ahh, I came across this fun little problem.
There are multiple things wrong with this code. Name as many of them as you can.
#include <vector.h>
void main(int argc, char** argv)
{
int n;
if (argc > 1)
n = argv[0];
int* stuff = new int[n];
vector<int> v(100000);
delete stuff;
return 0;
}
#include <vector.h> // Should be <vector>
void main(int argc, char** argv) // evil main declaration, anybody who does this deserves horrible death
{
int n; // Uninitialized variable
if (argc > 1) // poor formatting... nitpicky I know but also kind of a useless if expression as argc will _always_ be 1 or more (at least on windows)
n = argv[0]; // implicit type cast from char* to int, will yield unexpected results especially for novices. Most compilers won't even let this build without complaining about it. Worse still, what's the intent here? This is a nonsensical statement.
int* stuff = new int[n]; // Potential for blowing up due to possible uninitialized variable above.
vector<int> v(100000); // namespace undeclared... requires std::. Also useless as not used anywhere.
delete stuff; // using incorrect delete, need to use scalar delete []
return 0; // main declared with void return type
}
Probably more stuff I haven't considered... but JFC, Hooman... how were you able to pack so much terrible into a tiny amount of code?