Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If <code>cFile</code> is a <code>char *</code>, indexing it like <code>cFile[posF]</code> is the same as doing <code>*(cFile + posF)</code>, or "give me the value of whatever is <code>posF</code> places from the start of the array." Your address-of operator (<code>&amp;</code>) is unnecessary, and if it weren't, it would probably be the opposite of what you wanted (you want dereference — <code>*</code> — which is automatically done for you with the subscript notation).</p> <p>As other people have suggested, the correct code is most likely:</p> <pre><code>lQueryData[posDB] = cFile[posF]; </code></pre> <p>The reason you get the particular warning you do is because using <code>&amp;cFile[posF]</code> gets the address of (i.e., <em>a pointer to</em>) the character in <code>cFile</code> at <code>posF</code>. However, when you then try to assign it to a place in the <code>lQueryData</code> array, it has to first cast that (internally) into a scalar type. A pointer is just a number that indexes into memory, and thus when used for anything but "pointing" to things, it's just an integer. Therefore, what you have is making an integer, from a pointer, without an explicit cast.</p> <p>You might consider compiling with <a href="http://clang.llvm.org" rel="nofollow">clang</a> instead of (what I presume is) GCC if you have access to it, it has much more accessible error messages. For instance, the error message for your code above is: <strong>warning: incompatible pointer to integer conversion assigning to 'char' with an expression of type 'char *'; remove &amp;</strong> (with a little visual pointer to the offending "&amp;" sign).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload