HELP: C language job test wanted 
Author Message
 HELP: C language job test wanted

Quote:

>                     RE: HELP: C LANGUAGE JOB TEST WANTED

>   Newsgroups: comp.lang.c
>          Post a followup article to newsgroup(s)

>          Send e-mail reply to: Tanmoy Bhattacharya
>   Date: 22 Oct 1996 12:12:39 -0600
>   Organization: Los Alamos National Laboratory


>NNTP-Posting-Host: qcd.lanl.gov
>X-Newsreader: Gnus v5.3/Emacs 19.34


><snip>
>> > 15. Which of these is correct and why is the other one wrong:

>> >     char * foo()
>> >     {
>> >             char * x = "foo";
>> >             return x;
>> >     }

>> >     char * bar
>> >     {
>> >             char y[] = "bar";
>> >             return y;
>> >     }

>> Personally speaking, I would say neither of these are correct,  I
>> would question anyone who chose to use your 'correct' code.

>Correctness is sometimes defined by rules other than style :-) The
>first is undoubtedly strictly conforming fragment, though I would use
>`const's all over the place to avoid a common error. The second leads
>to undefined behaviour the moment the return value is used!

Why doesn't the first example yield undefined behaviour upon
referencing the return value?
--


Mon, 19 Apr 1999 03:00:00 GMT  
 HELP: C language job test wanted


Quote:
> Why doesn't the first example yield undefined behaviour upon
> referencing the return value?

See The C FAQ Question 1.32.
It is on a slightly different topic, but understanding the answer
to 1.32 will enable you to understand the answer to your question.


Mon, 19 Apr 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. HELP: C language job test wanted

2. C as 2nd CS language (was Re: Languages ...

3. HELP: Entry Level job C test

4. How to test (Re: C language test)

5. SURVEY of CS depts. (languages)

6. C as First Language for CS

7. Programming Language for Undergrad Intro CS Course?

8. Newbie: separate big .cs file into small .cs files

9. Job Opportunity for Programmers all languages

10. JOB OPENING: SENIOR SOFTWARE ENGINEER - COMPILERS, LANGUAGES - DENVER, CO

11. Job-US-WA-Seattle-Software Test Engineer

12. C test for job candidates?

 

 
Powered by phpBB® Forum Software