有点不理解这个例子中的一个部分,求解析
程序代码:
do { /* If there is not enough memory, allocate some more */ if(length >= max_length) { max_length += LENGTH_INCREMENT; pTemp = (char*)malloc(max_length); if(pStr) /* If we have already read characters */ { /* copy them to the new memory */ for(int i = 0 ; i<length ; i++) pTemp[i] = pStr[i]; free(pStr); } pStr = pTemp; pTemp = NULL; } }while((pStr[length++] = getchar()) != '\n');
这个例子中while((pStr[length++] = getchar()) != '\n');最后是不是找到’\n',那这个循环不就不能运行了?
((pStr[length++] = getchar()) != '\n')这个式子的内部运行我有点搞不清...能不能帮忙说明一下