User Profile
Collapse
-
Perfect - This explains a lot. Thanks for your advice :) -
Strange Behaviour initializing bool
Hi,
I was under the impression that bool's were false by default... Am I wrong about this?
In VC++6, when I define a bool in a class header (i.e. bool testbool) and then access it BEFORE I have initialized it to a definite value, it returns 1. I am sure that I have not accidentally initialized it to true anywhere. Just curious, is it supposed to be this way?
Cheers,
Crispin -
The whole array so that it can be reallocated --
Ganymede -- re. the PM. Sorry, I didn't mean to ignore your post - I was just hoping that there was a way to delete the whole array without cycling through every single element.
Cheers,
CrispinLeave a comment:
-
Hi,
Thanks to both of you for your replies --
So is it necessary to create a loop and delete every element individually when the array is larger than 2D? I was king of hoping that I could just use
delete[][] blabla[firstDimension] for a 3D array, but I don't wan't any memory leaks.
Cheers,
CrispinLeave a comment:
-
3D arrays
Hi,
I have been working on allocating and deleting multi-dimensional arrays...
I gather that to delete a 2D array correctly, you need to do the following:
for (int a = thisFirstElemen t; a < totalFirstEleme nts; a++)
{
delete[] blabla[a];
}
But how would I delete a 3D array? Would it just be delete[][] blabla[a] or am I missing something?
Thanks,
C... -
Thanks a lot Ganon, that really clears things up.
Does the same thing apply for char strings... i.e. if you initiate a char array (unsigned char *b). Do you deallocate the string like an array (delete []b) or like a single pointer (delete b).
Cheers,
CrispinLeave a comment:
-
Pointer Array Question
Hi,
I was wondering if I can do the following without creating memory problems:
Create something like -- int * array1 -- as a public member my class
then initiate it with a new value every time I run a certain function, like this --- array1 = new int[somenumber] ---
but ONLY delete it in the destructor --- delete [] array1 ---
If I reinitiate it with a new value... -
Hi Ganon,
This is what I was looking for, thank you ;)
Sorry about the double post, but I hit back and then thought I had forgotten to post it at all.
Cheers,
CrispinLeave a comment:
-
include techniques
Hi,
Proper file including is a part of C++ that I obviously didn't understand very well, because I've been puzzling over this for a couple of hours.
Lets say there are 4 files:
file1.cpp
file1.h
file2.cpp
file2.h
file1.cpp needs access to file1.h and file2.h ... file2.cpp needs access to file1.cpp and file2.h AARRG I can't work out the proper way to include this... -
Hi,
Thanks for your help... I got it working!
I passed the class as 'this'. And added 'MiniHost *m = (MiniHost*)user Data;' in the static int. To use the methods I simply type m->whatever();
Cheers,
CrispinLeave a comment:
-
Passing a Class as a Pointer
Hi Everyone,
I was hoping one of you kind souls could help me with the following:
I have a class method which initializes audio libraries written in C, shown below... where it says (RIGHT HERE) I am trying to create a pointer to the class MiniHost, am I doing it right?
>>>>>
void MiniHost::setup Audio()
{
////Some unimportant stuff here, then:...
No activity results to display
Show More
Leave a comment: