Hi all,
Can you help me? Why this warning appears in the next simple code ?
warning: passing argument 1 of ‘atoi’ makes pointer from integer
without a cast.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int i;
char line[100];
int main ()
{
printf("Enter line:\n");
fgets(line,size of(line),stdin) ;
line[strlen(line)-1]='\0';
for (i=0;i<strlen(l ine);i++)
{
printf("line[%d]=%d\n",i,atoi(l ine[i]));
}
exit(0);
}
when excuting:
$ ./test
Enter line:
this is a test
Segmentation fault
Can you help me? Why this warning appears in the next simple code ?
warning: passing argument 1 of ‘atoi’ makes pointer from integer
without a cast.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int i;
char line[100];
int main ()
{
printf("Enter line:\n");
fgets(line,size of(line),stdin) ;
line[strlen(line)-1]='\0';
for (i=0;i<strlen(l ine);i++)
{
printf("line[%d]=%d\n",i,atoi(l ine[i]));
}
exit(0);
}
when excuting:
$ ./test
Enter line:
this is a test
Segmentation fault
Comment