I am confused about expressions, side effects, types, and values in C++? -


my teacher handed me homework assignment. beginner, i'm not sure @ start, or chart asking for. can explain me simply? teacher wants fill in type, side-effect (if applicable,) , value:

(http://i172.photobucket.com/albums/w32/ravela_smyth/graph%201_zpslyxjgpde.jpg) (http://i172.photobucket.com/albums/w32/ravela_smyth/graph%202_zpskoo3upjw.jpg)

edit: why keep getting flagged down? don't understand did wrong?

it simple:

expression, part of code, something, + b

type, asking, result type of expression, can tricky in c++ :).

side-effects, statement has result type , result of sort expression can in same time update variables in process sife effects.

here example:

int = 0; int j = 0; int k = 1;  auto rslt = cout << ++i << ( j += 2) << (k *= 5);  //now type of rslt be? => &ostream, because &cout of type ostream // , used overloaded operators ostream , overloaded operator // returning ostream // hope know auto, auto leaving decision type on compiler. 

on screen there be: 125 side effects:

++i // side effect of operation i:  1 (j += 2) // side effect of operation j: 2 (k *= 5) // side effect of operation k: 5 

the value cout.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -