I looked at a couple of instances in which I see something like char fl[1] in the following code snippet. I can not guess what could be the use of such a design.
struct test { int i; double j; char fl[1]; }; int main(int argc, char *argv[]) { struct test a,b; ai=1; aj=12; a.fl[0]='c'; bi=2; bj=24; memcpy(&(b.fl), "test1" , 6); printf("%lu %lu\n", sizeof(a), sizeof(b)); printf("%s\n%s\n",a.fl,b.fl); return 0; }
output -
24 24 c<some junk characters here> test1
Shraddha
source share