All pastes #710614 Raw Edit

Mine

public c v1 · immutable
#710614 ·published 2007-09-25 17:27 UTC
rendered paste body
#include <stdio.h>char ringbuffer[9][9]; //char matrix with size for 10char stringsint nextToPut=0;int nextToGet=0;void put(char* c){        int i=0;        while(i<9){                ringbuffer[nextToPut][i]=c[i];                i++;        }        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";        char* myString2="hellow";        put(myString);        put(myString2);        pChar=get();        printf("char is:%s\n",pChar);        pChar=get();        printf("char is:%s\n",pChar);}OUTPUTbkw@sandbox:~/code/buffertest$ ./a.outstring copiedstring copiedchar is:hellochar is: