title: How can sum of FTW->base and some string (path) returns a string?
body: <p>I call <code>nftw()</code> function like this:</p>
  <pre><code>nftw(&quot;/sys/class/tty&quot;, opearate_on_tty_item, 1, flags)
  </code></pre>
  <p>and function <code>nftw()</code> executes function <code>operate_on_tty_item()</code> for every item that it finds in the folder <code>/sys/class/tty</code>.</p>
  <p>Function <code>operate_on_tty_item()</code> gets argumments directly from <code>nftw()</code> and it checks if current <code>/sys/class/tty/&lt;device&gt;</code> device has subfolder <code>device/driver</code> <em>(this means it is a physical device)</em> and prints this device in a slightly different format i.e. <code>/dev/&lt;device&gt;</code>. The function itself looks like this:</p>
  <pre><code>static int opearate_on_tty_item(const char *path, const struct stat *buffer, int flags, struct FTW *ftw_structure)
  {
  
      max_sub_directories = 1;
  
      // If depth is higher than max_sub_directories, ignore this field and advance to the next file.
      if (ftw_structure-&gt;level &gt; max_sub_directories) {
          // Tell nftw() to continue and take next item.
          return 0;
      }
      // Concatenate string of the object's path, to which we append &quot;/device/driver&quot;.
      strcat(directory_concatenation, path);
      strcat(directory_concatenation, &quot;/device/driver&quot;);
  
      // Open the directory stored in concatenated string and check if it exists
      if ((directory = opendir(directory_concatenation))) {
  
          // Reset concatenated string to null string.
          directory_concatenation[0] = '\0';
  
          // Concatenate string.
          strcat(directory_concatenation, &quot;/dev/&quot;);
          strcat(directory_concatenation, path + ftw_structure-&gt;base);
  
          printf(&quot;%s\n&quot;, directory_concatenation);
      }
      // Close the opened directory.
      closedir(directory);
  
      // Reset concatenated string to null string.
      directory_concatenation[0] = '\0';
  
      return 0;
  
  }
  </code></pre>
  <p>The thing I don't understand here is the line:</p>
  <pre><code>strcat(directory_concatenation, path + ftw_structure-&gt;base);
  </code></pre>
  <p>This line summs <code>const char * path</code> and <code>ftw_structure-&gt;base</code>. But the <code>printf()</code> that follows</p>
  <pre><code>printf(&quot;%s\n&quot;, directory_concatenation);
  </code></pre>
  <p>prins a string <em>(for example <code>/dev/ttyUSB0</code>)</em>! How is this possible? How is this string created using the sum operation of a constant character pointer and an integer?</p>
  <p>I am completely confused because FTW member FTW.base is defined in POSIX header <code>ftw.h</code> like this <em>(it is an integer)</em>:</p>
  <pre><code>/* Structure used for fourth argument to callback function for `nftw'.  */
  struct FTW
    {
      int base;
      int level;
    };
  </code></pre>
  <p>So how does POSIX compliant system know to display the string? How is this even calculated?</p>