help me with global variable and local variable
I want to implement double linked list and get max, min, med from it, but my compiler says the global variable and local variable overrides. I want my max, min stored in global variable and always use it in search algorithm but the error keeps obstructing me. Could help me with the code? https://code.sololearn.com/c4eHSh6RfW8V/#cpp _____________________________________ #include <fstream> #include <string> #include <sstream> #include <vector> #include "DLinkedList.h" ifstream inputfile; ofstream outputfile; int max = 0; int min = 0; int med = 0; _______________~~~~~__________________ void DLinkedList::add(int val, const Elem& e) { DNode* u = new DNode; DNode* s = new DNode; s = header; u->elem = e; u->value = val; if (empty() == 1) addBack(u); else { while (s->next->value > u->value) { s = s->next; if (s->next->value > u->value) { u->next = s->next; u->prev = s; u->prev->next = s->next->prev = u; } } } max = trailer->prev->value; min = header->next->value; med = findmedian(header); }