Learn to Say, “Hello, World”

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;
    }
时间: 2024-08-08 01:26:15

Learn to Say, “Hello, World”的相关文章

【Machine Learn】决策树案例:基于python的商品购买能力预测系统

决策树在商品购买能力预测案例中的算法实现 作者:白宁超 2016年12月24日22:05:42 摘要:随着机器学习和深度学习的热潮,各种图书层出不穷.然而多数是基础理论知识介绍,缺乏实现的深入理解.本系列文章是作者结合视频学习和书籍基础的笔记所得.本系列文章将采用理论结合实践方式编写.首先介绍机器学习和深度学习的范畴,然后介绍关于训练集.测试集等介绍.接着分别介绍机器学习常用算法,分别是监督学习之分类(决策树.临近取样.支持向量机.神经网络算法)监督学习之回归(线性回归.非线性回归)非监督学习(

TF.Learn

TF.Learn 手写文字识别 转载请注明作者:梦里风林Google Machine Learning Recipes 7官方中文博客 - 视频地址Github工程地址 https://github.com/ahangchen/GoogleML欢迎Star,也欢迎到Issue区讨论 mnist问题 计算机视觉领域的Hello world 给定55000个图片,处理成28*28的二维矩阵,矩阵中每个值表示一个像素点的灰度,作为feature 给定每张图片对应的字符,作为label,总共有10个la

Is it too late to learn to code?

Erin Parker, Founder Spitfire Athlete, iOS Engineer 9k upvotes by Francis Chen, Gaurav Baheti, Yue-Wing Yau, Maria Guryanova,(more) It's never too late. So much can happen in a year, it can amaze you. I majored in Economics. When I was about 23, I ra

Learn Python the Hard Way--Exercise 46

0. 缘起 <Learn Python the Hard Way>Exercise 46 要求安装四个python package pip, distribute, nose, virtualenv,(原书作者特别提醒: Do not just donwload these packages and install them by hand. Instead see how other people recommend you install these packages and use th

教程 1:让我们通过例子来学习(Tutorial 1: Let’s learn by example)

通过这第一个教程,我们将引导您从基础完成创建简单的带有注册表单的应用. 我们也将解释框架行为的基本方面.如果您对Phalcon的自动代码生成工具有兴趣, 您可以查看 developer tools. 确认安装(Checking your installation)? We'll assume you have Phalcon installed already. Check your phpinfo() output for a section referencing "Phalcon"

Learn Python From &#39;Head First Python&#39; [3](2) : Pickle

1.the use of 'with open... as ...' 2.the use of pickle(dump and load) for Step1: the 'with open ... as...' is the short format of 'try...except...finally' for Step2: you can store a list with pickle.dump() and get the content again with pickle.load()

Learn Docker

Learn Docker A Container is to VM today, what VM was to Physical Servers a while ago. The workload seems to shifting towards containers, and fast! In case you haven’t started ramping on it yet, you may find it a bit overwhelming to begin with. I thou

Java-集合(没做出来)第四题 (List)写一个函数reverseList,该函数能够接受一个List,然后把该List 倒序排列。 例如: List list = new ArrayList(); list.add(“Hello”); list.add(“World”); list.add(“Learn”); //此时list 为Hello World Learn reverseL

没做出来 第四题 (List)写一个函数reverseList,该函数能够接受一个List,然后把该List 倒序排列. 例如: List list = new ArrayList(); list.add(“Hello”); list.add(“World”); list.add(“Learn”); //此时list 为Hello World Learn reverseList(list); //调用reverseList 方法之后,list 为Learn World Hello package

快速入门:十分钟学会PythonTutorial - Learn Python in 10 minutes

This tutorial is available as a short ebook. The e-book features extra content from follow-up posts on various Python best practices, all in a convenient, self-contained format. All future updates are free for people who purchase it. Preliminary fluf

Stanford iOS Learn Notes - 3

题目是iOS Learn Notes,不过这篇文章更多的是梳理了一下过去半个月的弯路:没有跟iOS视频,去看国内的教材去了…… 掐指一算,已经半个月没有更新这个博客了,恍恍惚惚了半个月呀. 其实这半个月也没有闲着,把<Swift语言实战入门>的前8章翻了一下.第8章没有看完,实在看不下去了.怎么评价呢?这本书可以看出来写的时候应该还是用心写了的,最起码不像有些书,直接粘贴复制Swfit的官方文档翻译. 看了也有收获,比如 首先又熟悉了一遍Swift语法.这本书对语法进行了精简提炼,所以通读一遍