What i understand from this code is it should count gaps in between words but when you execute, it gives how many times you entered blank, tab and endline.. Anybody can help me? I am stuck.Code:#include <stdio.h> #include <stdlib.h> int main(){ int c,lastc,gap; lastc='a'; gap=0; while((c=getchar())!=EOF){ if((c==' ' || c=='\t' || c=='\n') && (lastc!=' ' || lastc!='\t' || lastc!='\n')){ gap++;} lastc=c; } printf("%d",gap); return 0; }
thanks.