🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

ऐरे वाले C प्रोग्राम का सही विकल्प चुनें:

Choose the correct option of C program having array:

int main () 
{ 
int xyz (4) = [10,20,30,40]; 
printf (“%d”, xyz (1)); } 

A)
B)
C)
D)

Explanation:

The given C code is:

int main () 
{ 
    int xyz(4) = [10, 20, 30, 40]; 
    printf("%d", xyz(1)); 
}

Explanation:

  1. Array Declaration: The code attempts to declare an array as int xyz(4) = [10, 20, 30, 40];.

    • The correct way to declare an array in C is by using square brackets, not parentheses.
    • It should be int xyz[4] = {10, 20, 30, 40};.
  2. Accessing Array: The code tries to access the array using xyz(1), which is incorrect. The correct way to access the array is xyz[1], not xyz(1).

So, there are syntax errors in both the declaration and the way the array is accessed.

Correct Answer:

(B) Compile error

Latest Updates