Thread: give me an explanation

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    8

    give me an explanation

    insert
    Code:
    int main(){
          int a[5]={5,1,15,20,25};
          int i,j,m;
          i=++a[1];
          j=a[1]++;
          m=a[i++];
          printf("%d %d %d\n",i,j,m);
          getch();
          return 0;
        }

    its output is coming 3 2 15 but i am not able to understand the reason.anybody clear me on this.

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,217
    I guess you should go read about variables and increment operators then. What exactly don't you understand? It's pretty straight forward. Make sure you're not confusing yours 1's and i's.
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. give me an explanation
    By shivam99aa in forum C Programming
    Replies: 11
    Last Post: 12-21-2012, 05:57 AM
  2. how here j is printing 7.give the explanation
    By sunil17 in forum C Programming
    Replies: 4
    Last Post: 09-03-2010, 09:36 AM
  3. Replies: 1
    Last Post: 06-29-2004, 05:23 PM
  4. Explanation
    By fallonides in forum C Programming
    Replies: 3
    Last Post: 03-19-2003, 01:41 PM
  5. Replies: 1
    Last Post: 02-11-2002, 12:00 PM