I have a function that will look something like this:

Code:
void function(node* root, int num)
{
    int i = 0;
    
    while(i < 10)
    {
        while(root->data != num || root != NULL)
        {
            root->next;
        }
        if(root->data == num)
        {
            root->count++;
            i++;
        }
    }
}
How do I get it so I can check root from the beginning of the list every time and still keep the updated count value??