i am doing a question in C , and it needs me to print the comments in for a .c file, for example , if the file is like

#include "stack.h"

#define STACK_CAPACITY 100


struct stack {
int *array;
int stack_top;
};

//<LOOK! "objects" "Allocate an object using malloc, then return a pointer">
struct stack *
stack_new()
{
//<LOOK! "casts" "malloc returns a void pointer. Cast to desired type" 2>
struct stack *s = (struct stack *)malloc(sizeof(struct stack));
s->array = (int *)malloc(STACK_CAPACITY * sizeof(int));
s->stack_top = 0;
return s;
}

int
stack_empty(struct stack *s)
{
return s->stack_top == 0;
}

int
stack_full(struct stack *s)
{
return s->stack_top == STACK_CAPACITY-1;
}

void
stack_push(struct stack *s, int n)
{
s->array[(s->stack_top)++] = n;
}

int
stack_pop(struct stack *s)
{
return s->array[--(s->stack_top)];
}

//<LOOK! "objects" "allways provide method to free."
void
stack_free(struct stack *s)
{
free(s->array);
free(s);
}



after , it asked to print out the comments like this format:


casts
./stack.c 23 24 malloc returns a void pointer. Cast to desired type


objects
./stack.c 19 27 Allocate an object using malloc, then return a pointer
./stack.c 54 59 allways provide method to free.



anyone can give a help on this or give me some ideas , thanks!