R
raj shekar
a[]={2,5,3,6.[0] = 9,4} what are a[0],a[1] ? and what is the lenth of an array?
a[]={2,5,3,6.[0] = 9,4} what are a[0],a[1] ? and what is the lenth of an array?
a[]={2,5,3,6.[0] = 9,4} what are a[0],a[1] ? and what is the lenth of an array?
I presume that there's an arithmetic type missing from the start of that
declaration?
Unless I'm missing something, that appears to have a syntax error. If
the '.' were replaced with a ',', the "[0]=9" part would be an example
of a designated initializer.
When you provide an initializer for an array, the length of the array
need not be specified; it is set based upon the number of elements in
the initializer.
The declaration
int a[] = {2, 5, 3, 6, [0]=9, 4};
is a shortcut that's equivalent to the following:
int a[5] = {2, 5, 3, 6, 4};
a[0] = 9;
As such, it's pretty pointless, dropping the designated initializer, and
replacing the '2' with a '9', would have the same effect. designate
initializers are mainly useful for sparse arrays, where you rely upon
the default zero-initialization to set the other elements:
int array[100] = {[42] = 100};
a[]={2,5,3,6.[0] = 9,4} what are a[0],a[1] ? and what is the lenth of an array?
I presume that there's an arithmetic type missing from the start of that
declaration?
Unless I'm missing something, that appears to have a syntax error. If
the '.' were replaced with a ',', the "[0]=9" part would be an example
of a designated initializer.
When you provide an initializer for an array, the length of the array
need not be specified; it is set based upon the number of elements in
the initializer.
The declaration
int a[] = {2, 5, 3, 6, [0]=9, 4};
is a shortcut that's equivalent to the following:
int a[5] = {2, 5, 3, 6, 4};
a[0] = 9;
a[]={2,5,3,6.[0] = 9,4} what are a[0],a[1] ? and what is the lenth of an
array?
raj shekar said:a[]={2,5,3,6.[0] = 9,4} what are a[0],a[1] ? and what is the lenth of an array?
The declaration
int a[] = {2, 5, 3, 6, [0]=9, 4};
is a shortcut that's equivalent to the following:
int a[5] = {2, 5, 3, 6, 4};
a[0] = 9;
Is this correct? Doesn't it set a[0] to 2, then a[1] to 5,
then a[2] to 3, then a[3] to 6, then a[0] to 9, then a[1] to 4,
resulting in an array of four elements containing [9,4,3,6]?
Ike Naar said:a[]={2,5,3,6.[0] = 9,4} what are a[0],a[1] ? and what is the lenth of an array?
I presume that there's an arithmetic type missing from the start of that
declaration?
Unless I'm missing something, that appears to have a syntax error. If
the '.' were replaced with a ',', the "[0]=9" part would be an example
of a designated initializer.
When you provide an initializer for an array, the length of the array
need not be specified; it is set based upon the number of elements in
the initializer.
The declaration
int a[] = {2, 5, 3, 6, [0]=9, 4};
is a shortcut that's equivalent to the following:
int a[5] = {2, 5, 3, 6, 4};
a[0] = 9;
Is this correct? Doesn't it set a[0] to 2, then a[1] to 5,
then a[2] to 3, then a[3] to 6, then a[0] to 9, then a[1] to 4,
resulting in an array of four elements containing [9,4,3,6]?
a[]={2,5,3,6.[0] = 9,4} what are a[0],a[1] ? and what is the lenth of an
array?
So you don't know jack shit; but you sure have opinions!
Kaz Kylheku said:a[]={2,5,3,6.[0] = 9,4} what are a[0],a[1] ? and what is the lenth of an
array?
So you don't know jack shit; but you sure have opinions!
int array[100] = {[42] = 100};
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.