| | |
Bus Error when I run my C++ program
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2005
Posts: 2
Reputation:
Solved Threads: 0
I need help. I keep getting a Bus Error when I run my program and I've narrowed down where it occurs to the following code fragment.
px0c0 and px0c1 are type double pointers and
count_x0c0[m] and countc0 are integers. Can anyone see why this code would be giving me a Bus Error? Thanks.
// set *px0c0 and *px0c1
for(int m=0;m<data.n;m++)
{
bayes.px0c0[m]=1.0 * (count_x0c0[m]/countc0);
bayes.px0c1[m]=1.0 * (count_x0c1[m]/countc1);
}
bayes.pc0 = 1.0 * countc0 / data.N;
px0c0 and px0c1 are type double pointers and
count_x0c0[m] and countc0 are integers. Can anyone see why this code would be giving me a Bus Error? Thanks.
// set *px0c0 and *px0c1
for(int m=0;m<data.n;m++)
{
bayes.px0c0[m]=1.0 * (count_x0c0[m]/countc0);
bayes.px0c1[m]=1.0 * (count_x0c1[m]/countc1);
}
bayes.pc0 = 1.0 * countc0 / data.N;
>px0c0 and px0c1 are type double pointers
How's your allocation of memory to px0c0 and px0c1?
How's your allocation of memory to px0c0 and px0c1?
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
And n and data.n are the same? And is data.N a type for data.n?
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
Similar Threads
- run program and rename file script help please (Shell Scripting)
- Error when tring to run program PLEasE Help (C++)
- Help with error message (C++)
- Error message when I run my program in C++ (C++)
Other Threads in the C++ Forum
- Previous Thread: How to read end of line?
- Next Thread: passing a vector to a function? :errors:
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






