title: Passing a global variable to a function - C++
body: <p>I am writing code for a router and I've made it to the part where I'm supposed to write code for a routing table. I've made a class which looks like this:</p>
  
  <pre><code>//Global variables
  unsigned char Dst_IP[4];
  unsigned char Nxt_Hop[4];
  int Mask;
  int OutIF;
  
  RTEntry::RTEntry(unsigned char *dst_IP, int mask, int outIF, unsigned char *nxt_Hop)
  {
      Dst_IP = dst_IP;
      Mask = mask;
      OutIF = outIF;
      Nxt_Hop = nxt_Hop;
  }
  
  bool match(unsigned char *IPaddress)
  {
      bool isMatch = false;
  
      if(IPaddress == dst_IP)
      {
          isMatch = true;
      }
  
      return isMatch;
  }
  </code></pre>
  
  <p>I'm getting an error when I try to compile due to the fact that dst_IP not is declared in the scope of the match function. Does anyone have an idea of how to fix this? It is probably something to do with pointers. I should probably mention that I'm quite new to C++..</p>
  
  <p>Thanks in advance!</p>