Serial Monitor Issue

This works

#include <Arduino.h>

int main()
{
  init();
  Serial.begin(9600);
  while (!Serial) {}
  Serial.println("Welcome to serial console");
  delay(25);
}

With no delay() or with with a lower delay() period the program ends before the serial output is completed. If you increase the baud rate then a shorter delay() can be used