基于c语言的数据结构求串长函数实现

问题遇到的现象和发生背景

c语言数据结构求串长函数

用代码块功能插入代码,请勿粘贴截图
#include
#include
#include
#include
typedef struct{
    char *ch;
    int length;
}BBT;
int StrAssign(BBT *T,char *chars){
    int i ;
    char *c;
    for(i=0,c=chars;*c;i++,c++);
    if(!i){
        T.ch=NULL;
        T.length=0;
    }
    else{
        if(!(T.ch=(char*)malloc(i*sizeof(char)))){
            return -1;
        }
        for(int n=0;n<=i-1;n++)
             T->ch[n] = chars[n];
             T->ch[i] = 0;
        T->length =i;
        }
    return 0; 
}
int StrLength(BBT S){
    return S.length;
}

运行结果及报错内容

[Error] request for member 'ch' in 'T', which is of pointer type 'BBT*' (maybe you meant to use '->' ?)
[Error] request for member 'length' in 'T', which is of pointer type 'BBT*' (maybe you meant to use '->' ?)
[Error] request for member 'ch' in 'T', which is of pointer type 'BBT*' (maybe you meant to use '->' ?)

我的解答思路和尝试过的方法

求遇见这个是什么意思,我之前的bbt已经定义了啊

把下面这段代码

typedef struct{
    char *ch;
    int length;
}BBT;

改为:

typedef struct _BBT{
    char *ch;
    int length;
} BBT;