Like Tree1Likes
  • 1 Post By itsme86

give me an explanation

This is a discussion on give me an explanation within the C Programming forums, part of the General Programming Boards category; 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 ...

  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,175
    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.
    MK27 likes this.
    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, 10:36 AM
  3. Replies: 1
    Last Post: 06-29-2004, 06: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21