title: warning: operand types are incompatible ("int" and "void *")
body: <p>I am using a pgcc compiler to compile the following piece of code. I keep getting this warning and I am not sure what is wrong with it.
  Here is the code, followed by the warning:</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;fcntl.h&gt;
  #include &lt;stdlib.h&gt;
  
  #ifdef _CRAY
  int MEMALLOC (nextptr, size)
  #else
  #ifdef POST_UNDERSCORE
  int memalloc_ (nextptr, size)
  #else
  int memalloc (nextptr, size)
  #endif
  #endif
  
  int *size;
  int *nextptr;
  {
    void *ptr;
    if (*nextptr == NULL) {
      if ((ptr = (void *) malloc (*size)) == NULL) {
        return(-1);
      }
    }
    else {
      if ((ptr = (void *) realloc (*nextptr, *size)) == NULL) {
        return(-1);
      }
    }
    *nextptr = (int) ptr;
    return (0);
  </code></pre>
  <p>These are the following errors that I get</p>
  <pre><code>memalloc.c&quot;, line 19: warning: operand types are incompatible (&quot;int&quot; and &quot;void
            *&quot;)
      if (*nextptr == NULL) {
                   ^
  &quot;memalloc.c&quot;, line 25: warning: argument of type &quot;int&quot; is incompatible with
            parameter of type &quot;void *&quot;
        if ((ptr = (void *) realloc (*nextptr, *size)) == NULL) {
                                     ^
  &quot;memalloc.c&quot;, line 29: warning: conversion from pointer to smaller integer
      *nextptr = (int) ptr;
  </code></pre>
  <p>What am I doing wrong?</p>