first commit
This commit is contained in:
57
str.c
Normal file
57
str.c
Normal file
@@ -0,0 +1,57 @@
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "str.h"
|
||||
#include "util.h"
|
||||
|
||||
#define INIT_SZ 20
|
||||
|
||||
void
|
||||
str_init(str *s)
|
||||
{
|
||||
assert(s);
|
||||
// <YOURCODE>
|
||||
}
|
||||
|
||||
void
|
||||
str_deinit(str *s)
|
||||
{
|
||||
if (s->ptr)
|
||||
free(s->ptr);
|
||||
s->ptr = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
str_init_data(str *s, const char *initial)
|
||||
{
|
||||
assert(s && initial);
|
||||
// <YOURCODE>
|
||||
}
|
||||
|
||||
char *
|
||||
str_data(str *s)
|
||||
{
|
||||
assert(s);
|
||||
// <YOURCODE>
|
||||
return NULL;
|
||||
}
|
||||
|
||||
str
|
||||
str_copy(str *s)
|
||||
{
|
||||
assert(s);
|
||||
// <YOURCODE>
|
||||
}
|
||||
|
||||
void
|
||||
str_append(str *s, char *p)
|
||||
{
|
||||
// <YOURCODE>
|
||||
}
|
||||
|
||||
void
|
||||
str_shrink(str *s, int sz)
|
||||
{
|
||||
assert(s && sz >= 0);
|
||||
// <YOURCODE>
|
||||
}
|
||||
Reference in New Issue
Block a user