Re: Recursive functions



Bill Pursell wrote:
On Apr 1, 6:37 am, "Harry" <geharipras...@xxxxxxxxx> wrote:

1)I need your help to solve a problem.
I have a function whose prototype is

int reclen(char *)

This function has to find the length of the string passed to it.But
the conditions are that no local variable or global variable should be
used.I have to use recursive functions.

Ask your instructor what the function should do if its
argument is not a string. Then ask your instructor
why you have been given an idiotic assignment which
will not help you learn to program well. Recursive
functions have a place, and this is not it. It is
unethical and/or incomptetent of your instructor to
teach you how to mis-apply a useful technique.

Why should this not be written as a recursive function? If you ignore
practical concerns which do not necessarily apply during the learning
process, do you have any reasons at all?

.



Relevant Pages

  • Re: Recursive functions
    ... I have a function whose prototype is ... int reclen ... should be used.I have to use recursive functions. ... Ask your instructor what the function should do if its argument ...
    (comp.lang.c)
  • Re: Recursive functions
    ... I have a function whose prototype is ... int reclen ... Ask your instructor what the function should do if its ... This is as good as anything to teach the basics of recursive functions. ...
    (comp.lang.c)
  • Re: Recursive functions
    ... I have a function whose prototype is ... used.I have to use recursive functions. ... int reclen ... Because different architectures and different compiler strategies lead to different sizes and forms of pointers. ...
    (comp.lang.c)
  • Re: Recursive functions
    ... I have a function whose prototype is ... int reclen ... used.I have to use recursive functions. ... Ask your instructor what the function should do if its ...
    (comp.lang.c)
  • Re: scanf(), ungetc() behaviour.
    ... ever won the fight with the instructor, ... but there should be no fight in the first place. ... int order2 ... better and asked for two arguments -- including one for when the pointers ...
    (comp.lang.c)