Solved

returning values

Posted on 1998-12-12
2
147 Views
Last Modified: 2010-04-02
When the main function is closed , we write return 0;
They say that the program returns 0 to dos. What is the theory behind it?what is IVT and how does it relate to program of c++.What distinguishes c++ from other programming languages?
0
Comment
Question by:shahid1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
Answers2000 earned 20 total points
ID: 1180003
You return an error code.  By convention 0 means your program worked.  Other values could mean an error occured.  Different values mean different errors (which number means which error is up to you).  Using this information programs which kick off your program can decide what to do next (example:a batch file).  This doesn't make sense for everything but does for a utility say.

IVT = ?  It's not in www.whatis.com.  IVT is VC help say InfoViewer Topic (the help system is divided into topics).  Other IVT = interrupt vector table (a jump table of where the CPU jumps in response to service each request).  Using a jump table in read/write memory allows you to patch the system interrupts.  You don't normally do that in C++ (but I guess you can on systems), it's normally an assembler type task.

C is a high level language with low level features (almost like a high level "assembler").  You can write readable high performance programs accessing low level resources.  C++ adds modern features (OO, templates, exceptions) to C.  Both languages leave it to the programmer to decide many things (you are not coodled), which is both good a bad (programmer has control but can easily mess up crashing the system/program etc)


0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1180004
IVT in this context is Interrupt Vector Table - an array in low memory containing the addresses of the different Interrupt Service Routines. DOS programmers made use of this feature for customising the system, writing TSRs as well as computer viruses.
The return value actually will indicate the exit status of your program. In DOS, you can execute your program from a batch file and check the return value with the DOS batch programming keyword ERRORLEVEL. As far as I can remember, the return value of main() in DOS can be obtained by examining the AX register.
Thanks
pagladasu
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Precision Problem in C++ 7 65
Indy 10 not Receiving UDP broadcast 3 52
Coding for the first time 9 96
Create a worker thread ( servicing thread) using the Message queue 3 45
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question