Question
Option 3 : Unspecified — depends on the compiler's order of argument evaluation / अनिर्दिष्ट — कंपाइलर के आर्गुमेंट मूल्यांकन क्रम पर निर्भर
Detailed Solution
सही उत्तर Unspecified — depends on the compiler's order of argument evaluation / अनिर्दिष्ट — कंपाइलर के आर्गुमेंट मूल्यांकन क्रम पर निर्भर है।
Question:
What is the output of the following C code? `int x = 5; printf("%d %d", x++, ++x);` / निम्नलिखित C कोड का आउटपुट क्या होगा? `int x = 5; printf("%d %d", x++, ++x);`
Correct Answer: Unspecified — depends on the compiler's order of argument evaluation / अनिर्दिष्ट — कंपाइलर के आर्गुमेंट मूल्यांकन क्रम पर निर्भर
The C standard does not fix the order in which function arguments are evaluated, and `x++` and `++x` both modify `x` without a sequence point between them, so the result is unspecified and varies across compilers. Assuming left-to-right evaluation is the trap. / C मानक फंक्शन आर्गुमेंटों के मूल्यांकन का क्रम तय नहीं करता, और `x++` तथा `++x` दोनों बिना sequence point के `x` को बदलते हैं, अतः परिणाम अनिर्दिष्ट है और कंपाइलर के अनुसार बदलता है। बाएँ-से-दाएँ मूल्यांकन मान लेना ही जाल है।