could you please tell me whats happening at line number 8 because, the output is
3,2,30. How can the value be incremented twice with just one increment.
Thanks !

#include<stdio.h>
#include<conio.h>
int main()
{
  int b[5]={10,1,30,40,50};
  int j,i,k=1,m;
    
    i=++b[1];
    j=b[1]++;
    m=b[i++];
    printf("%d %d %d",i,j,m);
    getch();
}

Recommended Answers

All 2 Replies

Note that i is incremented at line 10

m=b[i++];

Thanks ! got it .............. :)

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.