Files
lab0.1_letscontinue/str.c
2025-09-27 03:54:38 +03:00

57 lines
584 B
C

#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>
}