V
valerij
Please help. I have been on this problem for a week now.
I am using Windows 98SE, Microsoft Visual C++ 6.0
The following program only works when the function is not
called, BUT the function does EXACTLY what is in the
main() function. I am completely at a loss.
//==============code
#include <iostream.h>
#include <stdlib.h>
int fill_a(__int64 *list) {
int n, i;
n=8;
delete [] list;
list = new __int64 [n];
for (i=0;i<n;i++) {
list=5;
}
return n;
}
int main() {
__int64 *list;
char buffer[20];
int n, i;
list = new __int64;
//n = fill_a(list);
n=8;
delete [] list;
list = new __int64 [n];
for (i=0;i<n;i++) {
list=5;
}
for (i=0;i<n;i++) {
_i64toa(list, buffer, 10);
cout << buffer << endl;
}
delete [] list;
return 0;
}
//==============end of code
When:
n = fill_a(list);
/*n=8;
delete [] list;
list = new __int64 [n];
for (i=0;i<n;i++) {
list=5;
}*/
An error arises:
============================================================
Microsoft Visual C++ Debug Library
Program: ...ES\MICROSOFT VISUAL
STUDIO\MYPROJECTS\TEST13\DEBUG\TEST13.EXE
File: dbgdel.cpp
Line: 47
Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
For information on how your program can use assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
[Abort] [Retry] [Ignore]
============================================================
Thank you,
Valerij
I am using Windows 98SE, Microsoft Visual C++ 6.0
The following program only works when the function is not
called, BUT the function does EXACTLY what is in the
main() function. I am completely at a loss.
//==============code
#include <iostream.h>
#include <stdlib.h>
int fill_a(__int64 *list) {
int n, i;
n=8;
delete [] list;
list = new __int64 [n];
for (i=0;i<n;i++) {
list=5;
}
return n;
}
int main() {
__int64 *list;
char buffer[20];
int n, i;
list = new __int64;
//n = fill_a(list);
n=8;
delete [] list;
list = new __int64 [n];
for (i=0;i<n;i++) {
list=5;
}
for (i=0;i<n;i++) {
_i64toa(list, buffer, 10);
cout << buffer << endl;
}
delete [] list;
return 0;
}
//==============end of code
When:
n = fill_a(list);
/*n=8;
delete [] list;
list = new __int64 [n];
for (i=0;i<n;i++) {
list=5;
}*/
An error arises:
============================================================
Microsoft Visual C++ Debug Library
Program: ...ES\MICROSOFT VISUAL
STUDIO\MYPROJECTS\TEST13\DEBUG\TEST13.EXE
File: dbgdel.cpp
Line: 47
Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
For information on how your program can use assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
[Abort] [Retry] [Ignore]
============================================================
Thank you,
Valerij