int main() { char *string1 = "ab"; char *string2 = "cd"; char *string3 = "acbd"; if(isInterleaved(string1,string2,string3) == 1) { printf("%s is interleaving of %s and %s \n", string3,string1,string2); } else { printf("no\n"); } return 0; }
map<string,GLuint> VertexBufferBuilder::getOffsets() const { map<string,GLuint> offsets; list<VertexAttribute>::const_iterator it; GLuint offset = 0; GLsizei attributeSizeInBytes; for (it=attributes.begin(); it!=attributes.end(); ++it) { offsets[it->getName()] = offset; attributeSizeInBytes = sizeof(GLfloat) * it->getComponents(); if (isInterleaved()) { offset += attributeSizeInBytes; } else { offset += attributeSizeInBytes * getCapacity(); } } return offsets; }
int main(void) { char str[MAXLINE], *token; char strArray[3][MAXLINE]; int idx; while (fgets(str, MAXLINE, stdin) != NULL) { char *pos = *strArray; bzero(pos, 3*MAXLINE); for (token = strtok(str, DELIMITERS); token != NULL; token = strtok(NULL, DELIMITERS)) { memcpy(pos, token, MAXLINE); pos += MAXLINE; } isInterleaved(strArray[0], strArray[1], strArray[2]) ? printf("interleaved\n") : printf("not interleaved\n"); } }