This question already has an answer here:
- Undefined behavior and sequence points 4 answers
int array[] = { 1 , 2 , 3 };
int *pointer = a;
for ( int i = 0; i < 3; i++ ){
*pointer++ *= *pointer;
}
This code gets the square of all the array elements but the output differs from computer to another.
Why is this undefined behavior?
Aucun commentaire:
Enregistrer un commentaire