формат "% s" ожидает аргумент типа "char *"

#include <stdio.h>
int main(void)
{
    int i,j,k;
    char st;
    printf("enter string\n");
    scanf("%s", st);
    printf("the entered string is %s\n", st);
}

Компиляция вышеуказанной программы дает мне предупреждение:

warning: format '%s' expects argument of type 'char *', but argument 2 has type 'int' [-Wformat]
palindrom.c:8:1: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'int' [-Wformat]

Что я здесь не так делаю?

Вот что происходит, когда я запускаю его:

$ ./a.out
enter string
kiaaa
the entered string is (null)

Edit:

Вот еще одна версия кода (сделаноchar st; вchar *st):

#include <stdio.h>
int main(void)
{
    int i,j,k;
    char *st;
    printf("enter string\n");
    scanf("%s", st);
    printf("the entered string is %s\n", st);
}

Тем не менее, он ведет себя так же во время выполнения.

Ответы на вопрос(7)

Ваш ответ на вопрос