Hey there! Sign in to join this conversationNew here? Join for free
Turn on thread page Beta
    • Thread Starter

    Do you have to annotate every line of code? Or just the procedures and their functions?

    Although I'm only an A1 student, I'm a pretty enthusiastic coder, and I'd say that the over commenting of code is something that starts to make code harder to understand. As as basic guideline I usually do this:

    #include <stdio.h>
    int bitsetq(int n, int b) {
    /* A truth test to check whether bit "n" of the binary 
        representation of dernary b is 1 */
            int index=0;
            int bin[50]={0};
            do {
                    bin[index++]=b % 2; /* mod 2 to give remainder */
                    b /= 2;
            while ( b / 2 != 0);
            if(bin[n] == 1)
                    return 1;
            return 0;
    int main(void) {
            if(bitsetq(1, 10))
            else printf("False");
    That just describes where the code's a bit trickier to understand, or basic function purposes.

    However, you sometimes get code like:

    i++; /* Increase i by 1 */
    Which is just overkill, the examiner, or whoever's marking it isn't stupid, and will understand that. Lots of comments make code hard to read.

    I'd recommend commenting basically, where you had to think about the code to get it to work, and what each function does. If you've got a particularly tricky array that you're working with, a brief description of what the array does is always useful.

    Hope this helps,


    LOL every line of code? that would take me a long time, no just local procedures explaining what they do

    ummmmm the A2 is centre assessed
    you must remember that the code/solution is just as worth as much as the analysis.

    hey guys i am an A2 student as well
    so what was the end result do we annotate each line or the procedures. hey i have only got 3 weeks before handing the final piece you better be quick lol.........
    well i have go a very complicated sysytem and tehrefore there is a lot of code involved. so what do you say..............
“Yanny” or “Laurel”

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.