ANSI C中有20多个用于处理字符串的函数: 注意:const 形参使用了const限定符,表示该函数不会改变传入的字符串.因为源字符串是不能更改的. strlen函数: 函数原型:unsigned int strlen(const char*) 用于统计字符串的长度.举例如下 void fit(char *,unsigned int); int main(void) { char mesg [] = "Things should be as simple as possible,"…
我们可以通过构造器函数(简称构造函数)来创建对象: function Her(){ this.child = 'Jon'; } 为了使用该函数来创建对象,我们需要使用new操作符,例如: var she = new Hew(); she.child; // Jon 使用构造函数创建对象的好处就是她可以接受一些参数,下面我们就来修改一下上面的例子: function Her(name){ this.name = name; this.child = 'Jon; this.whoAreYou = f…