Even the staff's implementation as far as this test is concerned, I noticed, doesn't "return" /test/index.html so to speak. However it does in fact call indexes() function to modify the URL, and redirect to index.html. This is adhered to even in my implementation. I don't seem to be understanding what they're asking of me exactly in this test apart from this. Any pointers are appreciated.

1 Answer 1


The staff's implementation does return /test/index.html. While your statement "However it does in fact call indexes() function to modify the URL, and redirect to index.html." is a reasonable human description of what the program does, it is not an accurate technical description.

As specified, indexes() function returns a pointer to a string that has been "dynamically allocate[d]...on the heap". Once control is returned to main, main will decide what to do with pointer that was returned. The redirect you describe, happens in main when it evaluates the "value" returned from indexes().

You need to review your indexes function. There is some problem with the way you are allocating/populating the pointer that is returned to char* index. Based on the fact that the index.php test passes check50, it is possible you are not allocating enough memory for index.html (since it is "one byte longer").

  • 1
    Just 1 byte of memory... Phew!! I had allocated (string length of path + 10).. I just made it (string length of path + 11)... It works now.. I was too overconfident to have gone back and checked for that error on my own. Lesson learnt. THANK YOU, THANK YOU, THANK YOU!!
    – abhi
    Commented Apr 19, 2016 at 6:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .