我正在学习教程,我的代码看起来很正常,但我收到一条消息,上面写着
This old-style function definition is not preceded by a prototype
Run Code Online (Sandbox Code Playgroud)
代码.c:
void viderBuffer()
{
int c = 0;
while (c != '\n' && c != EOF)
{
c = getchar();
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助。对不起,如果我的帖子不完美,我是新来的。
在下面的代码中,我初始化了一个 int 指针,然后动态分配了内存。
但是当我想显示数组的大小时,它不会显示值5:
int *p=NULL;
int tab[]={};
p=tab;
p=malloc(5*sizeof(int));
printf("sizeof(tab)=%d",(int)sizeof(tab));
Run Code Online (Sandbox Code Playgroud) 如何使用扩展运算符访问对象数组中的元素?
const array = [{ obj: 1},{ obj: 2}]
console.log([...array].obj)
// Output undefined
console.log([...array.obj])
// Output Uncaught TypeErrorRun Code Online (Sandbox Code Playgroud)
我看过这篇文章在对象数组上使用扩展运算符?这非常相似,但它们不会尝试访问元素。
那么是否可以在对象数组上使用扩展运算符来访问元素?如果是这样怎么办?