I'm trying to read a string including spaces so scanf wouldn't work so I'm trying to use fgets. When I run it and it hits the if statement what prints on screen is:
Please enter the course name.
You entered the course: 
Please enter the course ID.
=======================
if(coursetotal==0)/*start of 1 course*/
    {
        printf("Please enter the course name.\n");
        fgets(course[0].name,sizeof(course[0].name),stdin);
        printf("You entered the course name: %s\n",course[0].name);
        printf("\nPlease enter the four digit course ID.\n");
        int temp=0,temp1=0,count=0; /*Variables used to check if 4 digits*/
        scanf("%d",&temp);
        temp1=temp;
        while(temp1!=0)
        {
            temp1/=10;
            count++;
        }
        if(count==4)/*start of is 4 digits*/
        {
            course[0].id=temp;
            coursetotal+=1;
            printf("You entered the course ID: %d\n",course[0].id);
        }/*end of is 4 digits*/
        else
        {
            printf("The course ID you input was not 4 digits.\n");
            return;
        }
        printf("You have successfully added the course: %s. The ID is : %d, and you now have a total of %d course.\n",course[0].name,course[0].id,coursetotal);
    } /*end 1 course*/