Jump to content

Photo

TraceA() -- A Trace Function, for Arrays

arrays trace utility function

  • Please log in to reply
No replies to this topic

#1 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 22 August 2015 - 10:29 AM

Something that I added to RPG.zh, for tracing arrays (all indices) in a neat, and tidy manner.

 

Requires string.zh.

 

void TraceA(int arr){
    int str[]="Tracing array with Pointer: ";
    int bufferPtr[7]=" ";
    itoa(arr,bufferPointer);
    int mainBuffer[40]=" ";
    strcat(str,mainBuffer);
    strcat(bufferPointer,mainBuffer);
    TraceNL();
    TraceS(mainBuffer);
    TraceNL();

    for ( int q = 0; q < SizeOfArray(arr); q++ ) {
        int str2[]="Index: ";
        int str3[]="is : ";
        int buffer[22]=" ";
        int bufferAmt[7]=" ";
        int bufferIndex[7]=" ";
        itoa(arr[q],bufferAmt);
        itoa(q,bufferIndex);
        strcat(str2,buffer);
        strcat(bufferIndex,buffer);
        strcat(str3,buffer);
        strcat(bufferAmt,buffer);
        TraceS(buffer);
        TraceNL();
    }
}




Also tagged with one or more of these keywords: arrays, trace, utility, function

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users