我需要为一个textfile print comments , 比如说有这么一个.c 的file,
#include "stack.h"
#define STACK_CAPACITY 100
struct stack {
int *array;
int stack_top;
};
//
struct stack *
stack_new()
{
//
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)];
}
//
void
stack_free(struct stack *s)
{
free(s->array);
free(s);
}
然后, 他要print出来
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.
就是把带LOOK! 的comment print 出来, 而且要显示行数, 不知道怎么做了, 谢谢大家有没有什么idea, 帮帮我~~是有关于C的, 不是C#,