jeudi 25 novembre 2021

How do you write a function that returns a node which value corresponds to a value stored in a variable?

I stumbled across this question in an old textbook I bought ages ago, whilst strictly speaking it is not too difficult, I could not find a post here that simply answered this one question. As such I thought "Hey perhaps someone starting out might be confused about this", and so I put together the following code:

#include <iostream>

using namespace std;

// Structures
struct charNode {
    char Node;
    charNode *next;
};

// Functions
charNode* getCharNode(char c) {
    return ; //<----- Return Node Here 
}

Aucun commentaire:

Enregistrer un commentaire