Could someone please tell me what these errors mean and how to fix them.
inputter.c: In function âget_next_tokenâ:
inputter.c:21: warning: initialization makes integer from pointer without a cast
inputter.c:17: warning: unused variable âcur_posâ
/* Get an RPN expression from the keyboard.
* Accepts q as indictation that user wants to quit.
* Skips over invalid characters.
* Normal end of expression is '='.
*/
#include <stdio.h>
#include <ctype.h>
#include "inputter.h"
char *get_next_token(void)
{
//return "123";
int i = 0;
char next_ch;
static char input_buffer [1000] = {""};
static int cur_pos = 0;
printf ("Enter an RPN expression ending with =\n");
fgets(input_buffer, 1000, stdin);
return input_buffer;
int length = input_buffer;
//here
do
{
next_ch = getchar();
if (tolower((int)next_ch) == 'q')
{
// User wants to quit.
input_buffer[0] = 'q';
i++;
break;
}
if ((next_ch == '\n') && (i > 0))
{
break;
}
if (isdigit(next_ch) ||
(next_ch == '+') ||
(next_ch == '-') ||
(next_ch == '*') ||
(next_ch == '/') ||
(next_ch == '=') )
{
input_buffer[i++] = next_ch;
}
} while ((input_buffer[i-1] != '=') && (i < length-1));
//here
input_buffer[i] = 0; // Provide null terminator.
while (next_ch != '\n') // Clear keyboard input buffer
{
next_ch = getchar();
}
}
/*
* This function prompts the user to enter an RPN string
* and reads the keyboard input into the buffer
* specified by the caller.
*/
//void get_input(char* input_buffer, int length);
char *get_next_token(void);