C Quiz: Pointers & Arrays

Arrays and pointers are closely linked in C but they are not the same thing. This quiz checks array-to-pointer decay, indexing through pointers, the cases where an array keeps its own type, and arrays of strings.

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

मोड चुनें

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

सैंपल सवाल

सवाल 1 / 10

What does this print?

#include <stdio.h>

int main(void) {
    int a[] = {10, 20, 30, 40};
    printf("%d %d\n", *(a + 2), 2[a]);
    return 0;
}
जवाब दिखाएं

A. 30 30 a[i] is defined as *(a + i), and addition does not care about order, so 2[a] is *(2 + a), the same element. Never write 2[a] in real code, but it shows how indexing works.

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

  • a[i] is defined as *(a + i)
  • Where an array does not decay: sizeof and &a
  • Passing part of an array to a function
  • char s[] vs char *s
  • Arrays of strings and pointers to arrays

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

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

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

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

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