K&R 1.9 exercise:Write a program to copy its input to its output, replacing each string of one or more blanks by a single blank.Is this correct and proper code? Could I have put c and inspace on a single line?#include <stdio.h>int main(void){    /*initializes c and inspace. */    int c;    int inspace;    /*sets inspace = 0*/    inspace = 0;    while((c = getchar()) != EOF)    {        if(c == ' ')        {            if(inspace ==0)            {                inspace = 1;                putchar(c);            }        }        if(c != ' ')        {            inspace = 0;            putchar(c);        }    }    return 0;}I am using the latest Ubuntu distro 64 bit.
Replacing each string of one or more blanks by a single blank
c;strings