检查给定的自然数是否有从头和尾读取的属性

Check if the given natural number has the property that it is read from the beginning and from the end

我需要完成任务:

编写一个函数来检查给定的自然数是否具有从头和尾读取的属性。该数字应作为 int 传递给函数。提示:用字符数组(字符串)替换数字。

我做到了,但是...不要编译。我现在,有一些愚蠢的错误,我没有看到。请看我的代码:

#include <stdio.h>
#include <string.h.>
#include <stdbool.h>

//Function is checking if number put to the string in string is this one, that we want to find
bool check(char *number);
int i;


{
    int leng=(int)strlen(liczba);
   for( i=0;i<leng/2;i++)
   if(number[i]!=number[leng-i-1])return false; //compare number from the beginning to thih from the 
end
                                      //if they are differetn, then false
return true; //thye are this same, so true

}


int main()
{
   int how_many=0;
   char number[20];
   printf("Give your number(max 20 digits") );
   scanf(" %d", &number);
   if(check(number))
   printf("Number has this same value");
   else printf("Number hasn't this same value");

}

错误:

#include <stdio.h>
#include <string.h.> /* extra . is here */
#include <stdbool.h>

//Function is checking if number put to the string in string is this one, that we want to find
bool check(char *number); /* extra ; is here */
int i; /* place of variable declaration is wrong */


{
    int leng=(int)strlen(liczba); /* undeclared "liczba" is used */
   for( i=0;i<leng/2;i++)
   if(number[i]!=number[leng-i-1])return false; //compare number from the beginning to thih from the 
end /* extra newline is before "end" */
                                      //if they are differetn, then false
return true; //thye are this same, so true

}


int main()
{
   int how_many=0;
   char number[20]; /* have no room for terminating null-character */
   printf("Give your number(max 20 digits") ); /* position of ")" is wrong */
   scanf(" %d", &number); /* format specifier is wrong and extra & exists */
   if(check(number))
   printf("Number has this same value");
   else printf("Number hasn't this same value");

}

固定代码:

#include <stdio.h>
#include <string.h>
#include <stdbool.h>

//Function is checking if number put to the string in string is this one, that we want to find
bool check(char *number)
{
   int i;


   int leng=(int)strlen(number);
   for( i=0;i<leng/2;i++)
   if(number[i]!=number[leng-i-1])return false; //compare number from the beginning to thih from the end
                                      //if they are differetn, then false
   return true; //thye are this same, so true

}


int main()
{
   int how_many=0;
   char number[21];
   printf("Give your number(max 20 digits)" );
   scanf(" %20s", number);
   if(check(number))
   printf("Number has this same value");
   else printf("Number hasn't this same value");

}