Value of variables in expression order not guaranteed.
This commit is contained in:
parent
a7ef300d73
commit
c8b2296bdd
17
main.cpp
17
main.cpp
@ -1,13 +1,16 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
int getValue()
|
||||||
|
{
|
||||||
|
std::cout << "Enter an integer: ";
|
||||||
|
|
||||||
|
int x{};
|
||||||
|
std::cin >> x;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
//char name[5] = {'t', 'e', 's', 't', '\0'};
|
std::cout << getValue() + (getValue() * getValue()); // a + (b * c)
|
||||||
char name[5] = "test";
|
|
||||||
char* t = name;
|
|
||||||
std::cout << t;
|
|
||||||
t[1] = 'a';
|
|
||||||
t[4] = 'b';
|
|
||||||
std::cout << t;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user