Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
180 views
in Information Technology by (110k points)
closed by

Which of the following statement(s) is/are correct w.r.t 'C' language?

(i) A part of the array can be passed to the function instead of the whole array.

(ii) Numeric array elements cannot be assigned initial values if the array is defined as a pointer variable.


1. Neither (i) nor (ii)
2. (i) and (ii) both 
3. (ii) only 
4. (i) only

1 Answer

0 votes
by (105k points)
selected by
 
Best answer
Correct Answer - Option 2 : (i) and (ii) both 

The correct answer is option 2.

Option 1: A part of the array can be passed to the function instead of the whole array.

True, C language does not allow to pass an entire array as an argument to a function. However, You can pass a pointer to an array by specifying the array's name without an index.

Option 2: Numeric array elements cannot be assigned initial values ​​if the array is defined as a pointer variable.

True,  If the array is defined as a pointer variable An array is a pointer, and you can store that pointer into any pointer variable of the correct type.

For example,

int A[10];

int* p = A;

p[0] = 0; makes variable p point to the first member of array A.

Setting p[0] = 0 is equivalent to setting A[0] = 0, since pointers p and A are the same. When numeric array elements cannot be assigned initial values it just assign the address of the array and pointer variable like int* p = A.

Hence the correct answer is both (i) and (ii).

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...