Army> If by "heap" you mean "memory available for dynamic
Army> allocation":
Army> #include <stdio.h>
Army> #include <stdlib.h>
Army> int main(void)
Army> {
Army> size_t size = 1;
Army> unsigned char *p = NULL;
Army> do {
Army> size *= 2;
Army> p = realloc(p, size);
Army> } while (p);
Army> printf("Heap size is less than %lu but more than %lu
Army> bytes.\n",
Army> (unsigned long)size, (unsigned long)size / 2);
Army> return 0;
Army> }
Army> But to change it you (if you can) would need system-specific
Army> ways. Try asking a newsgroup about Unix.
I don't think this does what the OP wants since realloc can (and on my
system does) change the size of the heap when it needs to.
<OT>
The heap size can be changed on Unix systems, man sbrk.
</OT>