標(biāo)題: 字符串與數(shù)組的長度判斷函數(shù) [打印本頁] 作者: xiaojuan 時間: 2014-9-17 14:33 標(biāo)題: 字符串與數(shù)組的長度判斷函數(shù) #include<stdio.h>
#include<string.h>
//void fit (char * zifuchuan, unsigned int size);
//void fit (char * , unsigned int size);
void fit (char * string, unsigned int size);
int main (void)
{
// char mesg[ ] = "I'm best, no one can shotme";
const char * mesg = "I'm best, no one can shotme";
puts(mesg);
fit (mesg, 7);
puts(mesg);
puts("Lets look at some of the string:");
puts (mesg +8); //從第八個數(shù)字輸出
return 0;
}
//void fit (char * zifuchuan, unsigned intsize) 編寫程序不可以太浮躁,這個是zifuzhuan上面是zifuchuan 不一樣,絕對不可以
void fit (char * string, unsigned int size)
{
// if (strlen(zifuzhuan) >size)
// *(zifuchan + size) ='\0';
if (