QUIZ - Tarleton State University

QUIZ

What are 3 differences between C and C++ const variables?

Solution

QUIZ

Source:

Solution

The C/C++ preprocessor substitutes "mechanically", from top to bottom inside the file. On the left, the occurrences of i inside main are both replaced by 20, whereas on the right they are both replaced by 30. Note that the compiler "sees" and empty function fun in both cases!

QUIZ: Pointer to function

What is wrong in this program?

Solution

The compiler expects ptr to point to a specific type of function ? one with a char as the first argument. Instead, when ptr is used to access func, the first argument is an int!

Note below that the C++ compiler is more strict than the C compiler (as expected):

Ch. 4: Data Abstraction

text

The only way to get massive increases in productivity is to leverage off other people's code. That is, to use libraries.

One of the primary design goals of C++ is to make library use easier.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download