Question

Identify the basic elements in a C++ program; briefly describe each element Describe the data types...

Identify the basic elements in a C++ program; briefly describe each element

Describe the data types you may use in C++, and their relationship to memory allocation?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer 1 :

Each C++ program contains at least one functions, one of which must be named main . A function consists of a sequence of statements that play out crafted by the function. The operating system executes a program by calling the function named main. That function executes its constituent statements and returns an incentive to the operating system.

Here is a straightforward rendition of main does only return an esteem:

int main()

{

return 0;

}

The operating system utilizes the esteem returned by main to decide if the program succeeded or fizzled. A return estimation of 0 indicates success.

The main function is special in different ways, the most imperative of which are that the function must exist in each C++ program and it is the (main) function that the operating system explicitly calls.

I will characterize main a similar way I characterize different functions. A function definition specifies four components: the return type, the function name, a (perhaps unfilled) parameter list enclosed in brackets, and the function body. The main function may have just a restricted arrangement of parameters.

The main function is required to have a return type of int, which is the type that speaks to integers. The int type is a worked in type, which implies that the type is characterized by the language.

The last piece of a function definition, the function body, is a block of statements beginning with an open curly brace and completion with a close curly:

{

return 0;

}

The main articulation in our program is a return, which is an announcement that ends a function.

At the point when the return includes an esteem such as 0, that esteem is the return estimation of the function. The esteem returned must have an indistinguishable type from the return type of the function or be a type that can be converted to that type. On account of main the return type must be int, and the esteem 0 is an int.

On most systems, the return an incentive from main is a status indicator. A return estimation of 0 indicates the successful completion of main. Some other return esteem has an implying that is characterized by the operating system. Normally a nonzero return indicates that a mistake occurred. Each operating system has its own specific manner of telling the client what main returned.

DEAR STUDENT ! WE ARE SUPPOSED TO ANSWER A SINGLE QUESTION FROM MULTIPLE POSTED QUESTIONS. KINDLY POST SEPARATELY TO GET ANSWERED.

RATE IT IF HELPS ELSE LET ME KNOW YOUR DOUBT. THANK YOU !

Add a comment
Know the answer?
Add Answer to:
Identify the basic elements in a C++ program; briefly describe each element Describe the data types...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT