📄 l18.1a
字号:
#printThere is nothing to force you to write a main programon each file; just as I supplied "getnum" on a separate file,you can put different routines on different files. Writea function "length(s)" which if given a character array argument"s" returns the length of that string.Put this on a file named "length.c", and leavethe object file in "length.o".Write the main program fortesting this somewhere else. Type "ready" when you have compiledand tested your program and are happy with it.#once #create RefThis file contains several lines of quite different lengths.You should getall of them exactlyrright.#once #create answer600141916#once #create tzaqc.cmain() { char s[200]; while (gets(s)) printf("%d\n", length(s));}#usercc tzaqc.c length.c a.out <Ref >value#cmp value answer#succeed/* one way */length(s)char *s;{ int k; for (k=0; s[k]; k++) ; return(k);}#log#next19.1a 10
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -