C++第三章理论题错题整理1

There are many rights to left associativity operators in C++, which means they are evaluation is done from right to left. Type Cast is one of them.

The operator which is having the highest precedence is postfix and lowest is equality.

Because the dynamic_cast operator is used to convert from base class to derived class.

#include <iostream>
    using namespace std;
    int main()
    {
        int a = 5, b = 6, c, d;
        c = a, b;
        d = (a, b);
        cout << c << ' ' << d;
        return 0;
    }

It is a separator here. In C, the value a is stored in c and in d the value b is stored in d because of the bracket.

There are five sequences of statements. They are Preprocessor directives, Comments, Declarations, Function Declarations, Executable statements.

The break statement need to be presented inside a loop or a switch statement.

for loop with a semicolon is called as body less for loop. It is used only for incrementing the variable values. So in this program the value is incremented and printed as 10.

There are four types of loop. They are the while, do while, nested, for the loop.

Normally the execution of the program in c++ starts from main only.

In a function, return type and function name are mandatory all else are just used as a choice.

C99 allows to pass a maximum of 127 arguments in a function.

In the call by reference, it will just passes the reference of the memory addresses of passed values rather than copying the value to new memories which reduces the overall time and memory use.

C++ uses void as the default return values for functions. It also restricts that the return type of the main function must be int.

Inline function is those which are expanded at each call during the execution of the program to reduce the cost of jumping during execution.

A function is not inline if it has static variables, loops or the function is having any recursive calls.

Default values for a function is defined when the function is declared inside a program.

There are three ways of passing a parameter. They are pass by value,pass by reference and pass by pointer.

By default how the value are passed by call by value.

The execution of the program is returned to the point from where the function was called and the function from which this function was called is known as caller function.

While overloading the return function, it will rise a error, So we can’t overload the return function.

原文地址:https://www.cnblogs.com/hhlys/p/13454480.html