IS IT POSSIBLE TO PASS AN ARRAY INTO A FUNCTION AND THEN CALCULATE THE PRIME NUMBERS OUT OF THE LIST?

Recommended Answers

yes, AND YOU DON'T HAVE TO SHOUT SO LOUD!

Jump to Post

All 2 Replies

yes, AND YOU DON'T HAVE TO SHOUT SO LOUD!

You could handle it some thing like this:

void getPrimesInList( Clist* in, Clist* out )
{
    Node* cur = in->head;
    while( cur )
    {            
        if( isPrime(cur->value) )
            push_backClist( out, cur );
        cur = cur->next;
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.