Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!