S
subramanian
Consdier the following program:
#include <stdio.h>
struct typeRecord {
int id;
char str[100];
} records[] = {
{0, "zero"},
{1, "one"},
{2, "two"},
{3, "three"},
{4, "four"},
{5, "five"},
{6, "six"},
{7, "seven"},
{8, "eight"},
{9, "nine"}
};
int main(void)
{
struct typeRecord rec1 = {10, "ten"};
int i;
for (i = 0; i < 10; ++i)
{
rec1 = records;
printf("%d %s\n", rec1.id, rec1.str);
}
return 0;
}
The above program produces the following output in both gcc and VC++.
0 zero
1 one
2 two
3 three
4 four
5 five
6 six
7 seven
8 eight
9 nine
My Doubt:
#include <stdio.h>
struct typeRecord {
int id;
char str[100];
} records[] = {
{0, "zero"},
{1, "one"},
{2, "two"},
{3, "three"},
{4, "four"},
{5, "five"},
{6, "six"},
{7, "seven"},
{8, "eight"},
{9, "nine"}
};
int main(void)
{
struct typeRecord rec1 = {10, "ten"};
int i;
for (i = 0; i < 10; ++i)
{
rec1 = records;
printf("%d %s\n", rec1.id, rec1.str);
}
return 0;
}
The above program produces the following output in both gcc and VC++.
0 zero
1 one
2 two
3 three
4 four
5 five
6 six
7 seven
8 eight
9 nine
My Doubt: