i wanna ask about this statement...

int a[] = {0};

the value all of a is it equal to 0 ?
i mean all of the location of a..

Recommended Answers

All 7 Replies

I'm not really sure what you mean by 'all of a'....

a[0] is equal to 0.
a is the address of the first element or &a[0].

i wanna ask about this statement...

int a[] = {0};

the value all of a is it equal to 0 ?
i mean all of the location of a..

all of the elements of array a is equal to zero(0).

I'm not really sure what you mean by 'all of a'....

a[0] is equal to 0.
a is the address of the first element or &a[0].

hmm..
i mean is all elements of a is it = 0 ?

all of the elements of array a is equal to zero(0).

but i don't think so ? :-O
coz i put this statement into my assignment it give me an incorrect result ... :(

int a[] = {0}; has only one memory defined to the array a i.e., a[0] which is initialized to zero. The only valid index in this case is a[0] . If you try to access other locations then it is an undefined behaviour.

int a[] = {0}; has only one memory defined to the array a i.e., a[0] which is initialized to zero. The only valid index in this case is a[0] . If you try to access other locations then it is an undefined behaviour.

oh..
i got it already..
thanks alot dude.. :)

oh..
i got it already..
thanks alot dude.. :)

i got it thnx :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.