title: Data type mismatch results in Runtime Error in C++
body: <p>I am writing a code to calculate kth root using binary search.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include&lt;math.h&gt;
  using namespace std;
  bool isPossible(long n,int k,long mid)
  {
      long ans=pow(mid,k);
      if(ans&lt;=n)
      {
          return true;
      }
      return false;
  }
  int main() {
      int t,k;
      long n;
      cin&gt;&gt;t;
      for(int i=0;i&lt;t;i++)
      {
          cin&gt;&gt;n&gt;&gt;k;
          int s=1;
          long e=n;
          long answer=n;
          while(s&lt;=e)
          {
              long mid=(s+e)/2;
              if(isPossible(n,k,mid))
              {
                  answer=min(answer,mid);
                  s=mid+1;
              }
              else
              {
                  e=mid-1;
              }
          }
          cout&lt;&lt;answer&lt;&lt;endl;
      }
  }
  </code></pre>
  
  <p>This code results in <strong>Permission denied
  collect2.exe: error: ld returned 1 exit status</strong>
  If I modify data type of <em>ans</em> in <em>isPossible()</em> function to double program run successfully, or if I modify the check statement to</p>
  
  <pre><code>    if(pow(mid,k)&lt;=n)
      {
          return true;
      }
  </code></pre>
  
  <p>I haven't seen this kind of error because of data type mismatch, I do not understand why this happens here, cause normally storing return value of pow() in int does not cause this type of error.</p>