gpt4 book ai didi

c - 如何在 C 中创建字符串数组?

转载 作者:太空狗 更新时间:2023-10-29 16:50:49 25 4
gpt4 key购买 nike

<分区>

我正在从一本书中自学 C,并且我正在尝试创建一个填字游戏。我需要制作一个字符串数组,但一直遇到问题。另外,我对数组了解不多......

这是一段代码:

char word1 [6] ="fluffy", word2[5]="small",word3[5]="bunny";

char words_array[3]; /*This is my array*/

char *first_slot = &words_array[0]; /*I've made a pointer to the first slot of words*/

words_array[0]=word1; /*(line 20)Trying to put the word 'fluffy' into the fist slot of the array*/

但我不断收到消息:

crossword.c:20:16: warning: assignment makes integer from pointer without a cast [enabled by default]

不确定是什么问题......我试图查找如何制作字符串数组但没有运气

任何帮助将不胜感激,

山姆

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com