Hi,
Here is my program. I've several queries related to it.
Code:
#include<stdio.h>
struct _test
{
int iNum[5];
};
typedef struct _test test;
int main(int argc, char** argv)
{
test newTest;
newTest.iNum[0] = 1;
newTest.iNum[1] = 2;
newTest.iNum[2] = 3;
newTest.iNum[3] = 4;
newTest.iNum[4] = 5;
printf("%d\n",newTest.iNum[0]);
printf("%d\n",newTest.iNum[1]);
printf("%d\n",newTest.iNum[2]);
printf("%d\n",newTest.iNum[3]);
printf("%d\n",newTest.iNum[4]);
}
1. Can I have an array without the size being specified inside a structure? For eg: Can I have it like this?
Code:
struct _test
{
int iNum[];
};
2. In the above program, I've initialized each element of the array individually. Is there any way to do it in one go? When I initialize it like
Code:
newTest.iNum = {1,2,3,4,5};
I'm getting an error.
Plz help..
Thanks,
Babu