ZONE
FEATURES
Home
News
Check Email
LEARNING ZONE
C++ Tutorial
Tutorials collection
Ask the Expert
FAQs
Refferences
ARTICLES
All articles
DOWNLOADS
Compilers
Sourcode Library
Tools/Utilities
WINDOWS
Win programing
C++ Builder
UNIX
Unix programming
Unix downloads
WEB PROGRAMMING
CGI programming
CGI Scripts
RESOURCES
Magazines
Newsletters
Mailing Lists
Courses
Links
COMMUNICATION
Message board
Chat
Communities
Organisations
C++ Groups
C++ Newsgroups
ABOUT US
Contact us
submit a resource
Privacy
Link to us
 
 
 
Home Ask the expert
 

Ask me a question

Main Q & A Page
 
SUBJECT : How do i determine my program's stack space?

Is there a way i can deteremnine the stack space of my program?

     
Sender : Jonathan Riddell  
 
Reply1

Depending on your program's function and parameter use, the amount of stack space your program requires will vary. Using your compiler linker directives, your programs can allocate a specific stack size.

As your programs execute, there may be times when you want to know the current stack size. If you are using Turbo C++ Lite, you can use the _stklen global variable.

The following program, stk_len.c, uses _stklen global variable to display the current stack size. (If you are using Microsoft Visual C++, the stackavail function returns the amount of available stack space)

#include <stdio.h>
#include <dos.h>
void main()
{
	printf("The current stack size is %d bytes\n", _stklen);
}
Sender : Chris  
 
 
 
 

Ask me a question

Main Q & A Page
 
 
A
Email Login
Password
New?
sign up!
 
A
Free Online tutorial & courses
 
A
Join Our Message board Discussions on C/C++
 
A
Unix Network
programming
tutorial
 
 Join Our Mailing list