Program Not responding

int main()
{
int x;
char* cp[REQUESTED_BLOCKS];
for (x=0; x< REQUESTED_BLOCKS; x++)
{
cp[x] = (char*) malloc(10000,1);
if (cp[x] == (char*) NULL)
break;
}

if (x < REQUESTED_BLOCKS)
printf("Bummer! My loop ended prematurely!\n");

getch();
return 0;
}

Hey Friend it is not working....In dev-C++ but in turbo it works why?
what you got as result?
You are using Conio.h which is not supported in Dev-C++. It works in Turbo because Turbo was made by Borland who made Conio.h.
conio.h is present in the MinGW version of the GCC headers, so Dev-C++ on Windows should find getch() ok (Dev-C++ does work with the GCC toolset, yes?).

Have you swapped platform as well as IDE?

Andy

P.S. Apparently conio.h is not Borlands fault. It originated with Latice C, the first ever DOS compiler (which Microsoft later bought and rebadged as (pre-Visual) Microsoft C.) Borland did, however, implement a slicker version.
http://en.wikipedia.org/wiki/Conio.h
Last edited on
Oh sorry did not know.
I got my info from here
http://www.bloodshed.net/dev/faq.html#conio
Last edited on
Please (oh, pretty please) use [code][/code] tags.

You are using Conio.h which is not supported in Dev-C++. It works in Turbo because Turbo was made by Borland who made Conio.h.


I have Dev-C++ installed on my computer (I like old things) and it does indeed come with conio.h.

conio.h is present in the MinGW version of the GCC headers, so Dev-C++ on Windows should find getch() ok (Dev-C++ does work with the GCC toolset, yes?).


Yes, Dev-C++ uses the GCC toolset and it does indeed have the getch (); function.

Now we need to get back to the issue, some response to cipp's question would be nice, what problems are you having? I tried compiling it and was told that malloc (size_t); was getting too many arguments from your post. From stdlib.h (from the MinGW pakage with Dev-C++):

_CRTIMP void* __cdecl malloc (size_t) __MINGW_ATTRIB_MALLOC;

The error I get:

346 D:\Dev-Cpp\include\stdlib.h too many arguments to function `void* malloc(size_t)' 


From stdlib.h (from Borland's C++ Compiler, 5.5. I know it's not Turbo, but it's the closest thing that I have from Borland):

void * _RTLENTRY _EXPFUNC malloc(_SIZE_T __size);
Last edited on
Topic archived. No new replies allowed.