C Quiz: Pass by Value & Pointers

In C every argument is passed by value, and pointers are how a function changes the caller's data. This quiz tests copies vs addresses, swapping, arrays as parameters and structs passed by value.

मीडियम 10 सवाल ~6 मिनट पास होने के लिए 80% C17

मोड चुनें

आप गेस्ट के तौर पर खेल रहे हैं: XP और streak सेव रखने के लिए साइन इन करें।

सैंपल सवाल

सवाल 1 / 10

What does this print?

#include <stdio.h>

void add_one(int n) {
    n++;
}

int main(void) {
    int x = 5;
    add_one(x);
    printf("%d\n", x);
    return 0;
}
जवाब दिखाएं

B. 5 n is a copy of x, so incrementing it changes only the copy, which disappears when the function returns. x in main is still 5.

इस क्विज़ में क्या है

  • Arguments are copies of the caller's values
  • Changing a variable through a pointer parameter
  • Arrays passed to functions decay to pointers
  • Structs are copied when passed by value
  • const pointer parameters and output parameters

अक्सर पूछे जाने वाले सवाल

क्या अकाउंट ज़रूरी है?

नहीं। कोई भी खेल सकता है। XP, streak, badge और हिस्ट्री सेव रखने के लिए साइन इन करें।

क्या मैं इसे दोबारा दे सकता हूं?

हां। आपका बेस्ट स्कोर सेव रहता है, और हर बार सवाल और जवाब शफ़ल होते हैं।