strlen 関数を使って取得すればよい。
sizeof という関数もあるが、strlen と振る舞いが異なるので注意。
例
#include<stdio.h>
#include<string.h>
int main () {
char moji[100] = "good morning";
printf("strlen(moji)=%lu\n", strlen(moji));
printf("sizeof(moji)=%lu\n", sizeof(moji));
return 0;
}
結果
strlen(moji)=12 sizeof(moji)=100