🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #13990

Re: Raar probleem in C

#13990
From: antares
Date: Sun, 06 May 2001 14:13
34 lines
1600 bytes
At Sun, 06 May 2001 11:51:49 GMT, Spiri wrote:
> Volgens mij mag je in een functie in C de waarden van de argumenten
> WEL veranderen zonder dat neveneffecten optreden, omdat er gebruik
> wordt gemaakt van call by value.

Strikt genomen werkt c inderdaad altijd met c.b.v., maar wat het veranderen
betreft,  iets als


#include <stdio.h>
#include <string.h>

void two(char s[])
{
        strcpy(s, "two");
}

int main(int argc, char **argv)
{
        char str[4];

        strcpy(str, "one");
	puts(str);
        two(str);
        puts(str);
}


zal str wel van "one" naar "two" doen veranderen.


antares
-- 
c... because you can't build universes upon E = m COBOL^2
Technical Details
Message-ID: <slrn9fan5c.vj.antares@antares.home.be>
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!nntp.cs.ubc.ca!newsfeed.direct.ca!look.ca!newsfeed.icl.net!skynet.be!louie!not-for-mail
References: <5h49dt44qracr24j8od92i6nb41g4nhu76@4ax.com> <AqcB6.32951$ii5.3335444@afrodite.telenet-ops.be> <5peafto752qkv3o3ume6l6bi1qb5mj3s0l@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII-7-bit
X-Google-Thread: fcea4,5b8f6d4a879dd9fb
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2001-05-06 07:14:08 PST
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!nntp.cs.ubc.ca!newsfeed.direct.ca!look.ca!newsfeed.icl.net!skynet.be!louie!not-for-mail
Newsgroups: be.comp.programming
From: antares@techie.com (antares)
Subject: Re: Raar probleem in C
References: <5h49dt44qracr24j8od92i6nb41g4nhu76@4ax.com> <AqcB6.32951$ii5.3335444@afrodite.telenet-ops.be> <5peafto752qkv3o3ume6l6bi1qb5mj3s0l@4ax.com>
Reply-To: antares@techie.com
Message-ID: <slrn9fan5c.vj.antares@antares.home.be>
User-Agent: slrn/0.9.7.0 (FreeBSD)
Date: 06 May 2001 14:13:59 GMT
Lines: 34
Organization: -= Skynet Usenet Service =-
NNTP-Posting-Host: 217.136.11.247
X-Trace: 989158439 reader1.news.skynet.be 43049 217.136.11.247
X-Complaints-To: abuse@skynet.be