hi:
i overload the operator new, codes shown as below:
void * __cdecl operator new(unsigned int size, const char *file, int line)
{
void *ptr = (void *)malloc(size);
return ptr;
}
and when i want to create a class object
CTest::CTest()
{
int a = 0;
}
CTest::~CTest()
{
int b = 0;
}
int main()...
Search Result
Collapse
6 results in 0.0040 seconds.
Keywords
Members
Tags
-
joey started a topic why construction called when i overload the operator new in c++ by calling mallocin Cwhy construction called when i overload the operator new in c++ by calling malloc
-
How do I access data lists created by yyparse ??
Hello all,
In my foo.y description I call yyparse() in main.
----------------------------------------
int main(int argc, char **argv)
{
...
yyparse();
...
/*Do something with a link list created by yyparse(); */
/* Then free the list*/
}
--------------------------------------------
As the comments in main show -
How do I manipulate... -
Allocating memory to structure.
Hello! It's my first post and my First time browsing this forum.
I am doing a piece of homework for about a week. I'm having problems allocating memory for a structure. Segmentation fault is the error. Code from example is missing. Here are the relevant parts:
Code:#include <stdio.h> #include <stdlib.h> #include <string.h> struct file{ char *name; int
-
malloc for long long array?
I'm a novice C programmer and am getting stuck on the insistence of malloc on using "size_t" for data array length. I want to use:
Code:float *array long long int n array = malloc(n*sizeof(float))
-
malloc array of structs + a little more
I'm having a problem with my array of structs and segmentation faults. I have this struct that represents one line of a source file:
Code:struct threeTokens { int lineNumber; char* cmd; char* param; }; line;
Code:program = malloc(numLines * sizeof(line)); while(NULL != fgets(buffer, SIZE, fp)){
-
Changing the size of an array passed to a function problem!
Hi all,
I have the following scenario:
Code:int main() { char a[] = "Hello"; printf("Modified string: %s\n", modify_str(a)); } char *modify_str(char *b) { /* Insert a '+' after every letter in the string */ /* "Hello" becomes "H+e+l+l+o+" */ return b; }