We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
You shouldn't use arrays like that. In fact, a is initialized with the first value of n what is garbage, something like 39281233, because is initialized in compile time not execution time, for dinamic size you must use pointers and the keyword new or vector from std.
Arrays Introduction
You are viewing a single comment's thread. Return to all comments →
Why did you add '&& N' in 'while(cout<
That's because only with
cout
the loop will never end, so I add other constraints, whenN
will be 0 the loop will end (N is like an inverse iterator).Sorry my english
thank you ^^
You shouldn't use arrays like that. In fact,
a
is initialized with the first value ofn
what is garbage, something like39281233
, because is initialized in compile time not execution time, for dinamic size you must use pointers and the keywordnew
orvector
fromstd
.