C - Excess elements in array

I am learning C and I am playing around with pointers and arrays. I am trying to create an array of pointers with the code below: const int NUM_P = 50; // Line 10 char *pS[NUM_P] = { NULL }; // Line 11 I am getting the following warnings and errors when I compile: → gcc array.c -o array
array.c: In function ‘main’:
array.c:11: error: variable-sized object may not be initialized
array.c:11: warning: excess elements in array initializer
array.c:11: warning: (near initialization for ‘pS’) I cannot figure this error out, I have looked online and been unable to find a explanation and solution of the problem. Can anyone help out? Cheers Eef
What are you trying to do in "char *pS[NUM_P] = { NULL }; " ?

以上就是C - Excess elements in array的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » CSS3 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准