Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you please explain this C code beside every code on each line: #include int Segments = -1; int Obstacle = 0; void Loopings() {

Can you please explain this C code beside every code on each line:

#include

int Segments = -1; int Obstacle = 0;

void Loopings() {

if(Obstacle > Segments) { Segments = Obstacle; } Obstacle = 0; }

int main () { int RoadSegments; int u, j, k; scanf("%d", &RoadSegments); int Course[RoadSegments + 3]; for(u = 0; u < RoadSegments; u++) { scanf("%d", &Course[u]); } for(j = 0; j < RoadSegments; j++) { if(Course[j] == 0) { if(j + 1 < RoadSegments) { if(abs (Course[j - 1] - Course[j + 1]) == 0 || abs (Course[j - 1] - Course[j + 1]) == 2) { Obstacle++; } else { Obstacle++; Loopings(); Obstacle++; } } else { Obstacle++; } } else { if(u + 2 < RoadSegments) { if(abs (Course[u] - Course[u + 2]) == 0 || abs (Course[u] - Course[u + 2]) == 2) { Obstacle++; continue; } else { Obstacle += 2; Loopings(); } } else { Obstacle++; continue; } } } Loopings(); printf("%d ", Segments); } Thank you !!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions

Question

Discuss the five steps that can be used to conduct a task analysis

Answered: 1 week ago

Question

What are the stages of project management? Write it in items.

Answered: 1 week ago

Question

why do consumers often fail to seek out higher yields on deposits ?

Answered: 1 week ago

Question

Advance warning and an explanation for the layoff.

Answered: 1 week ago