vendredi 1 mai 2015

confusing conditional statement in a for loop

I saw a code and i am astonished to see a conditional statement. i have tried running it but the loop becomes a infinite loop. the full code is :

#include <iostream>
using namespace std;

int main(int argc, char *argv[])
{
  int *n; 
  for (int i=0; i<5e7; i++) 
  n = new int; 
  delete n; 
}  

how does that even compile? and why does the loop become an infinite loop ? what are these type of conditional statements? and how does its even possible?

Aucun commentaire:

Enregistrer un commentaire