#include <readline/readline.h>
#include <stdio.h>
int main(int argc, constchar * argv[])
{
int j;
printf("Where should I start counting? ");
int i = readline(NULL);//Incompatible pointer to integer conversion initializing 'int' with an expression of type 'char *'
for (j=i; j>=0; j--)
{
if (j % 3 == 0)
{
printf("%d\n", j);
if (j % 5 == 0)
printf("Found one!\n");
}
}
return 0;
}
Since you haven't included readline.h, we don't know what its declaration is.
From the error message, it would appear that readline() returns a char pointer, which you're trying to assign to an int.
i still don't get it. all i am trying to do here is prompt the user to input a number and then store the user input in variable i without using the scanf. now is it possible to fix this code.
If you want to write C++ code then don't use <stdio.h> (say printf(), scanf(), ...). Instead of you should use streams as Code Apperentice said. See http://www.cplusplus.com/reference/iolibrary/ for details and a lot of examples.