What does string + int perform in C?

后端 未结 3 483
栀梦
栀梦 2021-01-05 07:43

I can\'t figure out this expression:

str + n

where char str[STRING_LENGTH] and int n.

I have worked a lot

3条回答
  •  离开以前
    2021-01-05 08:06

    str can be regarded as pointing to the memory address associated with a character sequence of length STRING_LENGTH. As such, c pointer arithmetic is being exploited in your statement str + n. What is is doing is pointing to the memory address of the nth character in the character sequence.

提交回复
热议问题