Why "n*n" results as 4 at the first instant of the loop? to me it should be 1*1. instead it comes as 2*2.
Please give me a simple answer as i'm still a beginner :)
#include <iostream>
using namespace std;
int main(){
    int n =1 , *p;
    p = &n;
    char aString[] = {"student"};
    for (int i = 0; i<5; i++)
        cout<< "i = "<< i << "n*n = "<<n*n<< "n++ = "<< n++<< " *p "<<endl; 
    system ("pause");
    return 0;
 }
				
                        
The evaluation order of elements in an expression is unspecified, except some very particular cases, such as the && and || etc.
writing:
you suppose an order and in particulr that n++ is the last evaluated.
To solve this problem you could split the exression in two parts: