G2 update; how C determines length of string

G2 is still being developed, I am currently working on modeling it in Inventor, so I can more easily happybirthdaytome work out the structural layout being that it is a much simpler design than the G1

also, if you wanted to know how C determines how long a char array is (which is just a char pointer with offsets in C)

int charlen(char *foobar)
{
     i=0;
     while(*(foobar+i)!=0)
     {
        i++;
     }
     return i;
}

*edit: updated post format

2 thoughts on “G2 update; how C determines length of string

  1. It actually runs through the code looking for whitespaces. When it detects a whitespace, it ends the loop.
    Iterating i each time the condition for the loop is true. Also pretty useful for C++ calculator applications.

Leave a Reply

Your email address will not be published. Required fields are marked *