Question
1.
2.
3.
4.
Answer (Detailed Solution Below)
Option 3 : d / d
Advertisement
Detailed Solution
सही उत्तर d / d है।
Key Points
Helpful?
Question:
What is the output of the following C code? `char *p = "abcde"; printf("%c", *(p + 2) + 1);` / निम्नलिखित C कोड का आउटपुट क्या होगा? `char *p = "abcde"; printf("%c", *(p + 2) + 1);`
1.
c / c
2.
b / b
3.
d / d
4.
Garbage value / कचरा मान
Correct Answer: d / d
`*(p + 2)` is `'c'`; adding 1 gives `'d'` (character arithmetic on the ASCII code). The trap option (a) ignores the `+ 1`, and (b) misreads the pointer offset. / `*(p + 2)` है `'c'`; इसमें 1 जोड़ने पर `'d'` मिलता है (ASCII कोड पर character arithmetic)। जाल विकल्प (a) `+ 1` को नज़रअंदाज़ करता है, और (b) पॉइंटर offset गलत पढ़ता है।
Downloaded from PrepSnap (prepsnap.in)