Skip to content

Conversation

Haricodezz
Copy link

fix: replace non-standard clrscr() with portable console clear alternative

  • Removed use of clrscr(), which is not part of the standard C library and causes compatibility issues across compilers and OS.
  • Added comments suggesting portable alternatives: system("cls") for Windows and system("clear") for Unix-like systems.
  • Updated code to use system-specific command with optional preprocessor condition for cross-platform support.

This ensures the AVL Tree program compiles and runs correctly in standard C environments.

// clrscr();
// Replaced clrscr() with system-specific clear command for portability.
#ifdef _WIN32
system("cls"); // Clear screen on Windows
#else
system("clear"); // Clear screen on Unix-like systems
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant