📄 len2.c
字号:
/*-*//******************************************************** * Answer to question 8.1. * * * * For full details, see the book. * ********************************************************//*+*/#include <stdio.h>int length(char string[]){ int index; /* index into the string */ /* * Loop until we reach the end of string character */ for (index = 0; string[index] != '\0'; ++index) continue; /* do nothing */ return (index);}int main(){ char line[100]; /* Input line from user */ while (1) { printf("Enter line:"); fgets(line, sizeof(line), stdin); printf("Length (including newline) is: %d\n", length(line)); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -