📜  C |数组|问题6

📅  最后修改于: 2021-05-28 05:50:09             🧑  作者: Mango

假设以下C变量声明

int *A [10], B[10][10];  

在以下表达式中
IA [2]
II A [2] [3]
III B [1]
IV B [2] [3]
如果在C程序(GATE CS 2003)中用作赋值语句的左侧,则不会产生编译时错误?

(A)仅I,II和IV
(B)仅II,III和IV

(C)仅II和IV
(D)仅IV答案: (A)
说明:请参阅以下说明。

int main() 
{ 
  int *A[10], B[10][10]; 
  int C[] = {12, 11, 13, 14}; 
  
  /* No problem with below statement as A[2] is a pointer 
     and we are assigning a value to pointer */
  A[2] = C;  
  
  /* No problem with below statement also as array style indexing 
      can be done with pointers*/
  A[2][3] = 15; 
  
  /* Simple assignment to an element of a 2D array*/
  B[2][3]  = 15; 
  
  printf("%d %d", A[2][0], A[2][3]); 
  return 0;
}

这个问题的测验

想要从精选的最佳视频中学习和练习问题,请查看《基础知识到高级C的C基础课程》。