我想获取一个字符串的长度,但我得到了错误的值,它说它只有4个字符长。为什么是这样?我是否正确使用sizeof()? #include <stdio.h>
int main(void)
{
char *s;
int len;
s = "hello world";
len = sizeof(s);
printf("%d\n", len);
}
我试图找到字符串的倒数第二个字符。我尝试使用word.length() -2,但我收到一个错误。我用java String Word;
char c;
lc = word.length()-1;
slc = word.length()-2; // this is where I get an error.
System.out.println(lc);
System.out.print
问题: Write a loop that traverses: ['spam!', 1, ['Brie', 'Roquefort', 'Pol le Veq'], [1, 2, 3]]
and prints the length of each element. 我曾尝试为我的解决办法: list = ['spam!', 1,['Brie', 'Roquefort', 'Pol le Veq