Difference between strncpy and memcpy?

前端 未结 5 1978
粉色の甜心
粉色の甜心 2020-12-05 03:10

How can i access s[7] in s?

I didn\'t observe any difference between strncpy and memcpy. If I want to print the o

5条回答
  •  不思量自难忘°
    2020-12-05 03:39

    To make "qwertyA" you need to set s[6] = 'A' and s[7]='\0'

    Strings are indexed from 0, so s[0] == 'q', and they need to be null terminated.

提交回复
热议问题