CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced:
Need help on a PERL program


New User

Apr 13, 2005, 8:24 AM

Post #1 of 3 (1203 views)
Need help on a PERL program Can't Post

 Hi to all,

I am new to this forum. I am a QA analyst, learining PERL. I would like to get some help on a program. Suggestion and comments would be much appreciated. Thank you.

LINE Contains
50 char * b, q, *r;
200 b=getbuf();
201 q = *b;
212 r= anotherfunction(b);
213-300 /* we want to use ‘q’ and ‘r’ here*/
2000 char * getbuf()
2001 {
2002 char buff[8];
2003-2050 /* unspecified, buff defined here *./
2051 return (char *) buff;
2052 }

1. What will be in variable ‘q’ after line 201 is executed? Under what conditions might this not be so?

2. Is there an alternative, but equivalent, way to write line 2000? If so, what is it?

3. Is getbuf() a reasonable function?

4. Will getbuf() execute at all?

5. Please comment on line 2051.

6. Is getbuf() good practice, and why?

7. What line not given should be provided for compilation?

8. How, exactly, could one get a second ‘char *’ to use back from this function? Be specific in terms of the exact syntax needed. (That is, provide code.) Another way to state this question is how can this function be modified to return a ‘char *’ (that is, it maintains the same return type) from the function, and an additional ‘char *’ value in one function call. Please make sure that your answer will work even if the size of the char * desired is not known in the outside calling function. Avoid (do not use) C++ syntax. Include statements in called and calling functions. Use good programming practice.

Thank you.


Apr 13, 2005, 9:45 AM

Post #2 of 3 (1201 views)
Re: [ndumbane] Need help on a PERL program [In reply to] Can't Post

I can't follow ur code, but you should not be posting the same question in different forums.

Thaumaturge / Moderator

Apr 17, 2005, 9:56 AM

Post #3 of 3 (1184 views)
Re: [ndumbane] Need help on a PERL program [In reply to] Can't Post

That's not Perl. It's C.

Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives