Link Details

You don't have to pay, but you do have to vote! Login and vote now.
Link 75093 thumbnail
User 282226 avatar

By ashishmohta
via technospot.net
Published: Apr 10 2008 / 12:22

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 - A bug in C
  • 5
  • 6
  • 1283
  • 334

Comments

Add your comment
User 111696 avatar

bloid replied ago:

1 votes Vote down Vote up Reply

From: http://en.wikipedia.org/wiki/C_%28programming_language%29#Arrays


x[i] = 1;
*(x + i) = 1;
*(i + x) = 1;
i[x] = 1; /* strange, but correct: i[x] is equivalent to *(i + x) */

User 236137 avatar

dzonelurker replied ago:

1 votes Vote down Vote up Reply

All C programmers should read Kernighan and Ritchie. At least it would prevent them form writing embarrassing blog postings.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.