title: Defining array elements using another array's elements
body: <p>I'm developing a webserver using C++ and I want a string array to contain the HTML code of my HTML elements.</p>
  
  <p>In the definition of that array, I want to supplement hard-coded characters with strings that are defined in other arrays.</p>
  
  <p>For example, my <code>webpages[]</code> array would contain the HTML for each webpage and be defined as:</p>
  
  <pre><code>string webpages[NUM_WEBPAGES] =
  {
    ...
    "&lt;p&gt;Please &lt;a href=\"" + urls[PAGE_LOGIN] + "\"&gt;login here&lt;/a&gt;&lt;/p&gt;",
    ...
  };
  </code></pre>
  
  <p>However, the HTML that gets sent to the client is:</p>
  
  <pre><code>&lt;p&gt;Please &lt;a href=""&gt;login here&lt;/a&gt;&lt;/p&gt;
  </code></pre>
  
  <p>As you can see, the url from <code>urls[PAGE_LOGIN]</code> was not populated into the HTML.</p>
  
  <p>I have confirmed via code inspection and gdb that <code>urls[PAGE_LOGIN]</code> has the value <code>/login</code>.</p>
  
  <p>(1) Why is this not working?</p>
  
  <p>(2) Is this possible?</p>
  
  <p>(3) If no, any recommendations?</p>
  
  <p>Thank you!</p>
  
  <p>EDIT:
  Minimal reproducible code example... because I don't know how to stackoverflow.</p>
  
  <p>Also my C++ is bad.</p>
  
  <pre><code>webpages.h:
  enum webpage
  {
    PAGE_LOGIN,
    NUM_WEBPAGES
  };
  
  extern string webpages[NUM_WEBPAGES];
  
  webpages.cpp:
  string webpages =
  {
    "&lt;p&gt;Please &lt;a href=\"" + urls[PAGE_LOGIN] + "\"&gt;login here&lt;/a&gt;&lt;/p&gt;",
  };
  
  urls.h:
  extern string urls[NUM_WEBPAGES];
  
  urls.cpp:
  string urls[NUM_WEBPAGES] =
  {
    "/login"
  };
  </code></pre>