int main(int argc, char * argv[]) { int arr[2][5] = {0,1,0,0,1, 0,1,0,1,1}; printStation(arr, 0, 5); return 0; }
void display_all_stations(struct station *front) { struct station *ptr; printf("\nPrinting all Station :END\n"); for (ptr = front; ptr != NULL; ptr = ptr->next) { printStation(ptr); } }
void printStation(int arr[2][5], int l, int n) { if(n-1 < 0) { printf("%d line in station %d\n", l, n); return; } printf("arr[%d][%d]=\n", l, n); printStation(arr, arr[l][n-1], n-1); printf("%d line in station %d\n", l, n); }
/* This function returns port number.*/ int search_station(struct station *front, char stationName[]) { struct station *ptr; for (ptr = front; ptr != NULL; ptr = ptr -> next) { fprintf(stderr, "\nsearch_station compare names:%s:%sEND\n",ptr->stationName, stationName); if (0 == strcmp(ptr->stationName, stationName) ) { fprintf(stderr, "\n Key found: duplicate station nameEND\n"); printStation(ptr); return ptr->portNumber; } } return 0; }