如何在C.链表迭代中编写此C ++代码?

// Recur for all the vertices adjacent to current vertex
list<int>::iterator i;
for (i = adj[src].begin(); i != adj[src].end(); ++i)
    if (!visited[*i])
        // Do Something

如何用C编写此代码?我尝试了以下方法,对吗?

while (graph->adjLists[src]->next != NULL)
{
    int i = graph->adjLists[src]->vertex;
    if (!visited[i])
    {
        // Do Something
    }
    graph->adjLists[src] = graph->adjLists[src]->next;