我正在使用这样的东西,但是它会抛出错误。
我只是将数组放在一个变量中并以这种方式传递它,但我正在查看近 500 行,例如无模式数据。(所以我不能使用循环)
此外,使用 GSList 的全部目的是避免锯齿状数组的限制
list43333 = g_slist_append(list43333,{11,12,13,14,15,17,18,20,22,25,30});
编辑:使用 `(int[]) 进行强制转换给出:
csgtk.h:14: warning: data definition has no type or storage class
csgtk.h:14: warning: type defaults to ‘int’ in declaration of ‘list43333’
csgtk.h:14: error: conflicting types for ‘list43333’
csgtk.h:12: note: previous definition of ‘list43333’ was here
csgtk.h:14: warning: passing argument 1 of ‘g_slist_append’ makes pointer from integer without a cast
/usr/include/glib-2.0/glib/gslist.h:52: note: expected ‘struct GSList *’ but argument is of type ‘int’
csgtk.h:14: warning: initialization makes integer from pointer without a cast
csgtk.h:14: error: initializer element is not constant
编辑:文字复制粘贴以显示它没有超出范围(注意,这是在 .h 文件的顶层):
GSList * list43333 = NULL;
list43333 = g_slist_prepend(list43333,(int[]){});
主文件
#include "csgtk.h"
GHashTable * widgetbuffer;
[...]