title: using const_cast to pass const data argument to a function whose parameter is a non-const
body: <p>We can use const_cast to pass const data argument to a function whose parameter is a non-const.</p>
  
  <pre><code>int fun(int* ptr)
  {
      return (*ptr + 10);
  }
  int main(void)
  {
      int val = 10;
      const int *ptr = &amp;val;
      int *ptr1 = const_cast &lt;int *&gt;(ptr);
      cout &lt;&lt; fun(ptr1);
      return 0;
  }
  Output:
  20
  </code></pre>
  
  <p>But, we can achieve the casting in the following way also,</p>
  
  <pre><code>int fun(int* ptr)
  {
      return (*ptr + 10);
  }
  int main(void)
  {
      int val = 10;
      const int *ptr = &amp;val;
      int *ptr1 = (int *)ptr;
      cout &lt;&lt; fun(ptr1);
      return 0;
  }
  </code></pre>
  
  <p>Output:
  20</p>
  
  <p>Then, what is the need for using const_cast in this particular scenario?
  Is there any advantage of using const_cast only in this particular scenario?</p>