i[3] or 3[i]
Last night a while writing a very basic program in ‘C’ language, I came across something weird. Basically in ‘C’ if you want to display the value of some element in an array it is denoted as i [no. of index], where ‘i’ is name of the array and in square bracket you write the index number, which u want to display.
The mistake I made was I wrote the index_number[name of array] ( Wrote 3[i] instead of i[3] ) and it gave the same result as it should have given, if I had written it correctly. Check the screenshot shown below.
Code:

Output

Now I m wondering how does that happen, I mean whatever I have read about ‘C’ programming as yet, says i[3] is the method to access the element at 3rd index, in fact I have not ever came across any notation of the form 3[i], so what’s the issue, have you ever seen this, why does this happen, any idea?
If you want to download this code and see it yourself, here is the file, we have uploaded it for you.
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
Posted on 9th April 2008 by Manav Mishra , here to write articles about things which are somehow related to computers, internet (and at times, may be, to blogging as well). He wants to make an Identity for himself, he loves, testing new softwares and services which can really help to improve the productivity of individual. All posts by Manav Mishra | Connect with me @
Twitter | Stumble
| Need more help? Ask your Questions at our Support Center



























Free Email Subscription
Leave your response!