Learn to Say, “Hello, World”
来源:互联网 发布:外设与cpu数据交换方式 编辑:程序博客网 时间:2024/05/17 18:26
Learn to Say, “Hello, World”
Thomas Guest
PAUL LEE, username leep, more commonly known as Hoppy, had a reputa- tion as the local expert on programming issues. I needed help. I walked across to Hoppy’s desk and asked whether he could take a look at some code for me.
“Sure,” said Hoppy, “pull up a chair.” I took care not to topple the empty cola cans stacked in a pyramid behind him.
“What code?”
“In a function in a file,” I said.
“So, let’s take a look at this function.” Hoppy moved aside a copy of K&R and slid his keyboard in front of me.
“Where’s the IDE?” Apparently, Hoppy had no IDE running, just some editor that I couldn’t operate. He grabbed back the keyboard. A few keystrokes later, we had the file open—it was quite a big file—and were looking at the function—it was quite a big function. He paged down to the conditional block I wanted to ask about.
“What would this clause actually do if x is negative?” I asked. “Surely it’s wrong.”
I’d been trying all morning to find a way to force x to be negative, but the big function in the big file was part of a big project, and the cycle of recompil- ing and then rerunning my experiments was wearing me down. Couldn’t an expert like Hoppy just tell me the answer?
102 97 Things Every Programmer Should Know

Hoppy admitted he wasn’t sure. To my surprise, he didn’t reach for K&R. Instead, he copied the code block into a new editor buffer, reindented it, wrapped it up in a function. A short while later, he had coded up a main func- tion that looped forever, prompting the user for input values, passing them to the function, printing out the result. He saved the buffer as a new file, tryit.c. All of this I could have done for myself, though perhaps not as quickly. But his next step was wonderfully simple and, at the time, quite foreign to my way of working:
$ cc tryit.c && ./a.out
Look! His actual program, conceived just a few minutes earlier, was now up and running. We tried a few values and confirmed my suspicions (so I’d been right about something!) and then he cross-checked the relevant section of K&R. I thanked Hoppy and left, again taking care not to disturb his cola can pyramid.
Back at my own desk, I closed down my IDE. I’d become so used to working on a big project within a big product that I’d started to think that was what I should be doing. A general-purpose computer can do little tasks, too. I opened a text editor and began typing:
#include <stdio.h> int main() { printf("Hello, World\n"); return 0; }
- Learn to Say "Hello, World"
- Learn to Say, “Hello, World”
- Let's say "Hello World!"
- Say hello to CSDN
- Say hello to everyone
- Say Hello to everybody !
- Say Hello To Everyone!
- Say Hello to Android!!!
- Say Hello to PowerShell
- Say Hello to CSDN
- Say Hello to Retrofit
- Say Hello to Retrofit
- Say hello to CSDN
- Say Hello to Retrofit
- To say "Hello world" in Python CGI Web Programming in 5 minutes
- Say hello to the universe!
- eclipse开发java say hello world
- hello to world
- springmvc的@RequestMapping、@PathVariable、@RequestParam
- 获取页面图片路径
- 语法高亮控件
- PHP Warning: PHP Startup
- 八皇后问题(回溯算法)
- Learn to Say, “Hello, World”
- SSH免密码登录远程主机
- 机器学习实战——第二章:K-近邻算法
- 已搬至 cnblogs
- Let Your Project Speak for Itself
- 详解如何在HTML中引用CSS
- 第11周 【项目2 - 职员有薪水了】(1)
- 易信免费电话,确实业界良心
- Atom编辑器折腾记_(7)Emmet实例教程