I have the below code which is supposed to exit if the provided user input is empty i.e they press [ENTER] when asked for the input. However it doesnt do anything if [ENTER] is pressed.
printf("Enter the website URL:\n");
scanf("%s", str);
if(strlen(str) == 0) {
printf("Empty URL");
exit(2);
}