Why are char[] and char* as typedefs different, but sometimes… not?

前端 未结 3 1173
遥遥无期
遥遥无期 2020-12-31 09:30

The following observation arose as I was following this question about char[] and char* differences.

#include 

typ         


        
3条回答
  •  心在旅途
    2020-12-31 09:51

    The C family is pass-by-value, and the C value of an array is a pointer to its first element. When you pass an item declared to be an array to a function, what's really getting passed is that pointer, and C treats the prototype as if you declared it that way.

提交回复
热议问题