Passing a string literal as a function parameter defined as a pointer

前端 未结 6 944
南旧
南旧 2021-02-05 20:19

I am reading the chapter on arrays and pointers in Kernighan and Richie\'s The C Programming Language.

They give the example:

/* strlen:  return         


        
6条回答
  •  滥情空心
    2021-02-05 20:46

    As it says in the first paragraph of the same page (Page 99, K&R2):

    "By definition, the value of a variable or expression of type array is the address of element zero of the array."

    The value of "hello, world" would be the address of 'h'.

提交回复
热议问题