Started learning C recently. I don't get what the problem is here:
#include <stdio.h>
#define MAXLINE 1000
void count(char *);
void getline(char s[]) {
char c;
int i = 0;
while ((c = getchar()) != EOF) {
s[i] = c;
++i;
}
}
int main() {
char line[MAXLINE];
// getline(line);
printf(line);
printf("\n");
count(line);
}
void count(char s[]) {
s[0] = 'a';
s[1] = 'b';
s[2] = 'c';
printf(s);
printf("\n");
}
error:
concepts/6-character-arrays.c:7:6: error: conflicting types for ‘getline’; have ‘void(char *)’
7 | void getline(char s[]) {
| ^~~~~~~
In file included from concepts/6-character-arrays.c:1:
/usr/include/stdio.h:645:18: note: previous declaration of ‘getline’ with type ‘__ssize_t(char ** restrict, size_t * restrict, FILE * restrict)’ {aka ‘long int(char ** restrict, long unsigned int * restrict, FILE * restrict)’}
645 | extern __ssize_t getline (char **__restrict __lineptr,