Thread: Homework help?

  1. #1
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    Question Homework help?

    I could not find these in my book, internet or the MSDN library?
    Can anyone help me?

    Q1. When a arry name is passed as an argument to a function, a pointer to the 1st element is passed to the function?

    a. T
    b. F
    I said T because you need to have a pointer to that array name, correct?

    Q2: A recursive () must have 2 properties: a limiting case that ends the sequence of recursions and each recursive call must get a little closer to the limiting case.

    a. T
    b. F

    ???
    can anyone explain these any further...
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

  2. #2
    Registered User
    Join Date
    Jul 2002
    Posts
    66
    Question 1 is true because arrays degrade to pointers to the first element when passed as formal parameters to a function.

    Question 2 is true because each recursion has to take you a bit closer to solving the problem and you have to know when to stop.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Actually, a recursive function doesn't have to have both properties as far as the C language is concerned.

    As far as C cares, you are perfectly find with creating, compiling and executing something like:

    void myfun( void ) { myfun( ); }

    It'll compile without warning or error. It's recursive.

    I suppose technicly it does have a limiting factor. It's called stack space.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Homework
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 11-03-2001, 04:39 PM
  2. Homework
    By kermi3 in forum C Programming
    Replies: 10
    Last Post: 09-27-2001, 04:49 PM
  3. Homework
    By kermi3 in forum C++ Programming
    Replies: 15
    Last Post: 09-26-2001, 03:16 PM
  4. Homework
    By kermi3 in forum C Programming
    Replies: 0
    Last Post: 09-10-2001, 01:26 PM