c语言编程求解。这个不会啊

c语言编写程序,输入身份证号码看是否成年了。
已知某人身份证号码的指针char *idno,编写函数,判断该人是否超过十八岁,如果是,返回1,否则返回0.
int judge(char *idno)


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

// 判断身份证号码对应的人是否超过十八岁
int judge(char *idno) {
    // 获取当前时间
    time_t now = time(NULL);
    struct tm *tm_now = localtime(&now);

    // 获取身份证号码中的出生年份
    int year = (idno[6] - '0') * 1000 + (idno[7] - '0') * 100 + (idno[8] - '0') * 10 + (idno[9] - '0');

    // 判断年龄是否超过十八岁
    if (tm_now->tm_year - year > 18) {
        return 1;
    } else {
        return 0;
    }
}

int main(int argc, char *argv[]) {
    char idno[18];

    // 输入身份证号码
    printf("请输入身份证号码:");
    scanf("%s", idno);

    // 判断身份证号码对应的人是否超过十八岁
    if (judge(idno)) {
        printf("超过十八岁\n");
    } else {
        printf("未超过十八岁\n");
    }

    return 0;
}


#include<stdio.h>

int main(){
    char ID[19];
    int year=0,i;
    scanf("%s",&ID);
    for(i=6;i<=9;i++)
    year=10*year+(ID[i]-'0');
    printf("%d",2018-year);
    if((ID[16]-'0')%2==1)
    printf("男\n");
    else
    printf("女\n");
    return 0;