Can anyone tell me what this means and how to fix it? I keep getting this warning, the title of this post, and I'm not quite sure on how to fix it. It is messing up what I'm trying to do. Here's the code:

#include <stdio.h>
#include <stdlib.h>
#define  MAXLINELEN 18


FILE  *getOpen();
void   push(int *, int *);
void   popShow();


struct  Stack
{
     int     row;
     int     col;
     struct  Stack *priorAddr;
}; 
struct Stack *tosp;
 
int main()
{  
   FILE        *inFile;       
   char        **matrix = 0;       
   int          nrows;             
   int          ncols;             
   int          i;
   int          row;
   int          col;
   char         singleLine[MAXLINELEN];
   int          size;
   int          location;
   int          rowElement;
   int          colElement;
   int          countSquares;
   int          block;
       
   
   
   // Open the text file containing the matrix.
   inFile = getOpen();
   tosp = NULL;
   
   // Read in each line of the matrix from the .txt file to determine the number of rows and columns.
   nrows = 0;
   ncols = 0;
   while (fgets(singleLine, MAXLINELEN - 1, inFile) != NULL)
   {
         nrows++;
         ncols++;
         printf("#%d: %s\n", nrows, singleLine);
   }
   size = nrows * ncols;
   printf("The size of the Matrix is: %d \n", size);
   
   // Dynamically allocate the matrix.
   matrix = malloc(nrows * sizeof(char *));
   if(matrix == NULL)
   {
        printf("Out of memory.\n");
        exit(1);
   }
   for(i = 0; i < nrows; i++)
   {
        matrix[i] = malloc(ncols * sizeof(char *));
        if(matrix[i] == NULL)
        {
             printf("Out of memory.\n");
             exit(1);
        }
   }
   printf("Memory allocated successfully!\n");
   
   // Populate the matrix with the data from the file.
   rewind(inFile);
   for (row = 0; row < nrows; row++)
    {
        for (col = 0; col < ncols; col++)
        {
           if (fscanf(inFile, "%c ", &matrix[row][col]) == 1)
           {
                printf("%c ", matrix[row][col]);
           }
           
        }
        putchar('\n');
    }
    
    // Search for every non-zero character in the matrix.
    for (rowElement = 0; rowElement < row; rowElement++)
    {
        for (colElement = 0; colElement < col; colElement++)
        {
            if (matrix[rowElement][colElement] > '0')
            {
                 printf("Non-Zero Character is at Row: %d  Col: %d\n", rowElement, colElement);
                 push(rowElement, colElement); // Warning comes from here.
            }
        }
    }
   
   popShow();
  
   
   printf("Number of squares: %d\n", countSquares);
   printf("Number of blocks: %d\n", block);
   
   
   
   
   
   
   
   
   system("pause");
   return 0;
   
}
   
/* =============================================
                   getOpen
   =============================================
   This function opens the file for reading, and 
   returns the file name back to the program for 
   use.
*/
FILE *getOpen()
{
     FILE *fname;
     char name[21];
     
     printf("\nEnter a file name: ");
     gets(name);
     fname = fopen(name, "r");
     if (fname == NULL)
     {
          printf("Failed to open the file %s.\n", name);
          exit(1);
     }
     printf("File was successfully opened!\n");
     
     return(fname);
}

/* ==============================================
                       push                      
   ==============================================
   This function pushes the element onto the 
   stack.
*/

void push(int *row, int *col)
{
     struct Stack *newPtr;
     
     newPtr = (struct Stack *) malloc(sizeof (struct Stack));
     if (newPtr == (struct Stack *) NULL)
     {
          printf("\nFailed to allocate memory for this structure\n");
          exit(1);
     }
          
     newPtr->row = row; // Warning comes from here
     newPtr->col = col;    //  and here.
     newPtr->priorAddr = tosp;
     tosp = newPtr;
}

/* ==============================================
                    popShow
   ==============================================
   This function pops the elements off of the
   stack and displays them.
*/

void popShow()
{
     int  row;
     int  col;
     void pop(int *, int *);
     
     printf("\nThe data popped from the stack are:\n");
     
     while (tosp != NULL)
     {
         pop(row, col); // Warning comes from here as well
         printf("Row: %d   Col: %d\n", row, col);
     }
}

/* ===============================================
                         pop
   ===============================================
   This function pops the data off the stack.
*/

void pop(int *row, int *col)
{
     struct Stack *tempAddr;
     
     tosp->row = row; // These pop up a warning as well
     tosp->col = col;
     tempAddr = tosp->priorAddr;
     free(tosp);
     tosp = tempAddr;
     
}

This is probably a stupid question and it's probably staring at me right in the face, but......I'm still quite new to C. Any help would be awesome!

Line 95: The arguments to this function are pointers use push(&rowElement, &colElement); Line 161: Opposite problem, row and col are pointers (the ones passed into the function, so dereference the right hand side like newPtr->row = *row; Line 199: same as 161.

Line 184: same as line 95
(around 184 you shouldn't have to prototype pop in this function (you can I suppose) but you should put it up before main() with the rest of them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.