Code Debugging Assistant
Prompt
I have the following code that is not working as expected: [PASTE YOUR CODE]. Please analyze it, identify the bugs, explain what is wrong, and provide a corrected version with comments.
Prompt copied to clipboard!
Description
I have the following code that is not working as expected: [PASTE YOUR CODE]. Please analyze it, identify the bugs, explain what is wrong, and provide a corrected version with comments.Example Outputs
Example Output:
Bug Analysis:
1. Line 5: Variable "count" is not initialized before use
2. Line 12: Array index out of bounds - loop should use "< length" instead of "<= length"
Corrected Code:
Explanation: The variable needs to be initialized to 0, and the loop condition should prevent accessing beyond array bounds.
Bug Analysis:
1. Line 5: Variable "count" is not initialized before use
2. Line 12: Array index out of bounds - loop should use "< length" instead of "<= length"
Corrected Code:
Explanation: The variable needs to be initialized to 0, and the loop condition should prevent accessing beyond array bounds.
Category:
Code Generation
Tested with:
ChatGPT (OpenAI)
Claude (Anthropic)