Yes I know the code is not complete. I know it will cause an infinite loop.

The question is how would I break out of the first for loop and go to the second for loop? Wouldn't using break, break you out of everything? I only wanna break one level.

while(sjn_completion_time_flag != 1)
{
    for(j = 1; j < i; j++)
    {
        if(completed_flag[j] == 0 && completion_time[j] >= arrival_time_array[j])
        {
            printf("completion_time[j]: %d \n",completion_time[j]);
            printf("time_cycles_required_for_job_array[j]: %d \n",time_cycles_required_for_job_array[j]);
            completion_time[j] = completion_time[j] + time_cycles_required_for_job_array[j];
            completed_flag[j] == 1;
            //condition to break
            break;
        }
    }
    //for loop
}

Break only breaks you out of one nested looping structure. So on the inside loop if you break, the inner loop will cease, and the outter loop will continue execution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.