All pastes #710396 Raw Edit

Miscellany

public c v1 · immutable
#710396 ·published 2007-09-25 14:30 UTC
rendered paste body
#include <stdio.h>#include <string.h>char ringbuffer[9][9]; //char matrix with size for 10char stringsint nextToPut=0;int nextToGet=0;void put(char* c){        while(strcmp(ringbuffer[nextToPut], c));        printf("string copied\n");        nextToPut++;}char* get(void){        if((ringbuffer[nextToGet]!=NULL)){                nextToGet--;                nextToPut--;                return ringbuffer[nextToGet+1];        }        else{                return NULL;        }}int main(){        char* pChar;        char* myString="hello";        put(myString);        pChar=get();        printf("char is:%s\n",pChar);}