title: swift error : Cannot convert value of type 'UnsafeMutablePointer<UInt32>?' to expected argument type 'UnsafeMutablePointer<Int32>?'
body: <p>I am working on <strong>Xcode 10 iOS project</strong>.
  I am trying to call a C language function from Swift which takes pointer as parameter.</p>
  
  <p>c function is as follows,</p>
  
  <p><strong>Compress.h</strong> file</p>
  
  <pre><code>short* Decompress(int *dataIn, int channelNum,int sample_cnt,long packet_cnt) ;
  </code></pre>
  
  <p>I am trying to call this method from <strong>MyClassfile.swift</strong></p>
  
  <p>Expected inputs from xcode is as follows</p>
  
  <pre><code>  var dataOut = Decompress(dataIn: UnsafeMutablePointer&lt;Int32&gt;!, channelNum: Int32, sample_cnt: Int32, packet_cnt: Int)
  </code></pre>
  
  <p>As the input for the first parameter is of type optional as "<strong>UnsafeMutablePointer&lt; Int32>!</strong>"</p>
  
  <p>I tried to convert the array to UnsafeMutablePointer type</p>
  
  <p>the code is as follows,</p>
  
  <pre><code>var uint32PktArray = [UInt32]()
  
  for index in stride(from: 0, to: somebuffer.count, by: 4){
            //doing some functionality here
            uint32PktArray.append(value)
  }
  
            let uint32Pointer : UnsafeMutablePointer&lt;UInt32&gt;? = UnsafeMutablePointer&lt;UInt32&gt;.allocate(capacity: uint32PktArray.count)
              uint32Pointer!.initialize(from: &amp;uint32PktArray, count: uint32PktArray.count)
  
            print(type(of: uint32Pointer))// returns UnsafeMutablePointer&lt;UInt32&gt;?
  </code></pre>
  
  <p>but the input param requires an optional type, and the method is called as below</p>
  
  <pre><code> var dataOut = Decompress(uint32Pointer,0, Int32(compHeaderECG0.smpl_cnt), Int(compHeaderECG0.pkt_cnt))
                  print(dataOut)
  </code></pre>
  
  <p>while compiling I am getting an error for the above code, <strong>"Cannot convert value of type 'UnsafeMutablePointer?' to expected argument type 'UnsafeMutablePointer?'"</strong></p>
  
  <p>Any help is really appreciated.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Let me know if any clarity is required</p>