You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(NB: is this just because i'm using C11 and not a newer dialect?)
examples:
struct aaa {
int a;
char flag;
char buf[]; // works if this is commented out or has a number inside [], or "char* buf;"
};
int main() {
struct aaa x = {1, 2};
return 0;
}
---
struct my_struct {
int n;
char s[]; // works if this is commented out or has a number inside [], or "char* s;"
};
int main() {
struct my_struct *s = malloc(sizeof(struct my_struct) + 50);
}
---
#include <stdlib.h>
struct flex {
size_t count;
double average;
double scores[]; // works if this is commented out or has a number inside [], or "double* scores;"
};
int main() {
struct flex *pf1;
pf1 = malloc(sizeof(*pf1));
return 0;
}
The text was updated successfully, but these errors were encountered:
a possibly-related example in C++ class (instead of struct) definition:
template<typename T>
class Node{
private:
T data;
Node<T>* children[]; // problem here! works if [] -> [10] (or any number) or "Node<T>** children;"
public:
Node(T data, char size) {
data = data;
for (char i = 0; i < size; i++) children[i] = 0;
}
};
int main() {
Node<int> node = Node<int>(5, 10);
return 0;
}
(NB: is this just because i'm using C11 and not a newer dialect?)
examples:
The text was updated successfully, but these errors were encountered: