C Char pointers

后端 未结 4 1920
旧时难觅i
旧时难觅i 2021-01-19 15:49

Let us say we have a array of pointers:

char *ptr[30];

Now this works fine, and doesn\'t seems to do anything unexpected! I can input names easi

4条回答
  •  萌比男神i
    2021-01-19 16:22

    If you use what is in your example, you just owerwrite other locations what come after your ptr array. Most compilers should actually give at least a warning. Your program would crash on most systems, you were just very lucky.

提交回复
热议问题