:: Re: [DNG] Studying C as told. (For …
Top Page
Delete this message
Reply to this message
Author: Steve Litt
Date:  
To: dng
Subject: Re: [DNG] Studying C as told. (For help)
On Wed, 22 Jun 2016 11:15:44 +0200
Edward Bartolo <edbarx@???> wrote:


> The program:
> --------------------------
> #include <stdio.h>
>
> void times2(int i[]) {
> i[0] = 33;
> }


Others have commented on value and reference. What I have to add is
this: Always take special care to name functions and variables
descriptively. For instance, either you should rename times2()
set_to_33(), or in its body you should put:

i[0] = i[0] * 2;

I wrote about readability here:

http://troubleshooters.com/tpromag/199908/index.htm

SteveT

Steve Litt
June 2016 featured book: Troubleshooting: Why Bother?
http://www.troubleshooters.com/twb