将多个空格合并为一个空格的疑问?
#include <stdio.h>
#define NONBLANK 'a'
/*输入复制到输出,多空格合并*/
main()
{
int c, lastc;
lastc = NONBLANK;
while((c = getchar()) != '\n')
{
if (c != ' ')
putchar(c);
if (c == ' ')
if(lastc != ' ')
putchar(c);
lastc = c;
}
}
各位大神:
请问lastc是如何代表前一个空格前一个字符的?