D
Dave
I'm currently working on a small project (admitedly for my CS class)
that compares the time difference between passing by value and passing
by reference. I'm passing an array of 50000 int's. However, since in
C++ an array is passed by reference by default I need to embed the
array into a struct in order to pass it by value. The problem is that
I get a segmentation error when doing so. I'm using the Dev-c++
compiler. Any ideas?
Here's the basic source:
....(code)...
void byval(struct Array a);
struct Array
{
int data[50000];
};
....(code)...
byval(a);
....(code)...
void byval(struct Array a)
{
// do nothing
}
Thanks in advance!
that compares the time difference between passing by value and passing
by reference. I'm passing an array of 50000 int's. However, since in
C++ an array is passed by reference by default I need to embed the
array into a struct in order to pass it by value. The problem is that
I get a segmentation error when doing so. I'm using the Dev-c++
compiler. Any ideas?
Here's the basic source:
....(code)...
void byval(struct Array a);
struct Array
{
int data[50000];
};
....(code)...
byval(a);
....(code)...
void byval(struct Array a)
{
// do nothing
}
Thanks in advance!