ok so it works now except one thing.....
The array before sorting: 4 3 2 1
The array after sorting: -708361232 1 2 3
trying to figure it out.... can anyone else spot it?
ok so it works now except one thing.....
The array before sorting: 4 3 2 1
The array after sorting: -708361232 1 2 3
trying to figure it out.... can anyone else spot it?
they said C++.....
They were wrong. VLAs are in C99 or a GCC-specific extension, but not C++.
Looks like an out-of-bounds memory access, and off-by-one error.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
well if it is c99 why is it working?.... ya i assumed it was an out of bounds.... just struggling to find it....
It is a g++ extension ported from gcc's support for C99. You can disable it with the -pedantic option (and/or -ansi, I am not too sure).well if it is c99 why is it working?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
well figured out the out of bounds error..... but the algorithm doesn't seem to work.... so gotta go figure that out :-P
thanks!