निम्नलिखित अरुडिनो कोड का आउटपुट क्या होगा?
What will be the output of the following Arduino code ?
void main() {
int k = 0;
double d = 10.21;
printf(“%lu”, sizeof(k + d));
}
void loop() {}
A)
B)
C)
D)
Explanation:
The code calculates the size of the result of k + d
, where k
is an integer and d
is a double. Since adding an integer and a double promotes the result to a double, the size of the result (k + d
) is 8 bytes (the size of a double on most Arduino boards). Therefore, the output is 8.
Correct answer: (B) 8.