Skip to content

oblerion/dstring.h

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dstring.h

dynamic string in c

Example

#include <stdio.h>
#include <stdlib.h>
#include "dstring.h"

int main()
{
    dstring* dstr = DSTRING();
    dstrcpy(dstr,"welcome");
    dstradds(dstr," all");

    puts("\n");
    for(int i=0;i<dstrlen(dstr);i++)
    {
        printf("%c",dstrat(dstr,i));
    }
    printf("\nfind e to %d pos",dstrfind(dstr,"e"));
    puts("\n");

    dstrcpy(dstr,"hello word");
    dstrsubn(dstr,6,4);
    puts(dstrtos(dstr));
    dstrfree(dstr);
    return 0;
}