The "break" keyword will break you out of the loop:

Code:
  while(1){
    printf("Stuck in the loop\n");
    if(somecondition){
      break;
    }
  }
  printf("Broke out of the loop\n");