Digital Stronghold - Software Engineering Blog




November 20, 2005

Counting a list recursively

Filed under: Progressive Studies

If there is an iterative way, there must be a recursive way.

int count_rec(LINK head)
{
        if (head == NULL)
                return 0;
	
        else
                return (1 + count_rec(head -> next));
}

Comments »

The URI to TrackBack this entry is: http://eradicus.blogsome.com/2005/11/20/count-a-list-recursively/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.

Theme designed by Joset Anthony Zamora


Digital Stronghold

↑ Get Headline Animator