Ken Thompson 的经典 C 程序

![](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)![](http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif) char s[]={ ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\t', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'0', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'}', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)';', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'m', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'a', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'i', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'(', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)')', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'{', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\t', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'i', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'t', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)' ', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'i', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)';', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\t', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'p', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'r', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'i', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'t', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'f', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'(', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'"', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'c', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'h', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'a', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'r', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)' ', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'s', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'[', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)']', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'=', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'{', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\\', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'"', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)')', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)';', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\t', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'f', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'o', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'r', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'(', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'i', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'=', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'0', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)';', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)' ', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'s', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'[', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'i', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)']', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)';', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)' ', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'i', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'+', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'+', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)')', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\t', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\t', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'p', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'r', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'i', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'t', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'f', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'(', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'"', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\\', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'t', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'%', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'d', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)',', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\\', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'"', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)',', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'s', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'[', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'i', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)']', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)')', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)';', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\t', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'p', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'r', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'i', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'t', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'f', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'(', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'"', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'%', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'s', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'"', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)',', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'s', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)')', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)';', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'}', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)'\n', ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)0 ![](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)}; main() ![](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)![](http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif){ ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)int i; ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif) ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)printf("char s[]={\n"); ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)for(i=0; s[i]; i++) ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)printf("\t%d,\n",s[i]); ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)printf("%s",s); ![](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)} ============输出结果=============== ![](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)![](http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)char s[]={ ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)9, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)48, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)10, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)125, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)59, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)10, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)10, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)109, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)97, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)105, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)110, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)40, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)41, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)10, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)123, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)10, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)9, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)105, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)110, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)116, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)32, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)105, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)59, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)10, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)10, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)9, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)112, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)114, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)105, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)110, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)116, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)102, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)40, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)34, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)99, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)104, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)97, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)114, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)32, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)115, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)91, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)93, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)61, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)123, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)92, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)110, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)34, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)41, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)59, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)10, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)9, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)102, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)111, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)114, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)40, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)105, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)61, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)48, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)59, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)32, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)115, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)91, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)105, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)93, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)59, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)32, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)105, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)43, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)43, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)41, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)10, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)9, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)9, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)112, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)114, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)105, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)110, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)116, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)102, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)40, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)34, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)92, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)116, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)37, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)100, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)44, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)92, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)110, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)34, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)44, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)115, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)91, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)105, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)93, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)41, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)59, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)10, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)9, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)112, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)114, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)105, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)110, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)116, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)102, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)40, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)34, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)37, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)115, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)34, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)44, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)115, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)41, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)59, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)10, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)125, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)10, ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)0 ![](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)}; main() ![](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)![](http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif){ ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)int i; ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif) ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)printf("char s[]={\n"); ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)for(i=0; s[i]; i++) ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)printf("\t%d,\n",s[i]); ![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)printf("%s",s); ![](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)}

[温馨提示]:该文章由原博客园导入而来,如排版效果不佳,请移步:http://www.cnblogs.com/coderzh/archive/2008/05/13/1194426.html

微信扫一扫交流

作者:CoderZh
微信关注:hacker-thinking (一个程序员的思考)
本文出处:https://blog.coderzh.com/2008/05/13/1194426/
文章版权归本人所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。