C++ Institute CPA-21-02 Exam - Topic 2 Question 42 Discussion
What happens when you attempt to compile and run the following code?#include using namespace std;int main(){int *i;i = new int;*i = 1.0 / 2 * 2 / 1 * 2 / 4 * 4;cout
C) It prints: 2
A) It prints: 0
B) It prints: 1
D) It prints: 0.5
C++ Institute CPA-21-02 Exam - Topic 2 Question 42 Discussion
Actual exam question for
C++ Institute's
CPA-21-02 exam
I remember something about integer division in C++. If I recall correctly, 1.0 / 2 would be treated as a double, but the result gets assigned to an int pointer.
Latia
7 months agoAltha
8 months agoAlana
8 months agoJamie
8 months agoBeckie
8 months agoMatilda
8 months agoJeffrey
9 months agoCory
9 months agoAlaine
9 months agoPhung
9 months agoOretha
10 months agoColby
10 months agoJesusa
10 months agoShantell
10 months agoKerrie
11 months agoBuddy
12 months agoMarylyn
12 months agoPearly
12 months agoLorriane
12 months agoWillodean
12 months agoDortha
12 months agoLorriane
1 year agoDortha
1 year ago