Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

%3Cp%20class%3D%22c1%22%26nbsp%3Bstyle%3D%22margin-right%3A%26nbsp%3B0px%3B%26nb

ID: 3546822 • Letter: #

Question

%3Cp%20class%3D%22c1%22%26nbsp%3Bstyle%3D%22margin-right%3A%26nbsp%3B0px%3B%26nbsp%3Bmargin-bottom%3A%26nbsp%3B0.5em%3B%26nbsp%3Bmargin-left%3A%26nbsp%3B0px%3B%26nbsp%3Bpadding%3A%26nbsp%3B0px%3B%26nbsp%3Bborder%3A%26nbsp%3B0px%3B%26nbsp%3Bfont-family%3A%26nbsp%3BHelvetica%2C%26nbsp%3BArial%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3Bline-height%3A%26nbsp%3B16px%3B%26nbsp%3Bvertical-align%3A%26nbsp%3Bbaseline%3B%26nbsp%3Bmax-width%3A%26nbsp%3B665px%3B%26nbsp%3Bcolor%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%22%3Ei%26nbsp%3Bsuppose%26nbsp%3Bto%26nbsp%3Bcomparte%26nbsp%3Btwo%26nbsp%3Btxt%26nbsp%3Bfiles%26nbsp%3Band%26nbsp%3Bdisplay%26nbsp%3Bmessage%26nbsp%3Bthat%26nbsp%3Bidentical%26nbsp%3Bor%26nbsp%3Bnot.%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22c1%22%26nbsp%3Bstyle%3D%22margin-right%3A%26nbsp%3B0px%3B%26nbsp%3Bmargin-bottom%3A%26nbsp%3B0.5em%3B%26nbsp%3Bmargin-left%3A%26nbsp%3B0px%3B%26nbsp%3Bpadding%3A%26nbsp%3B0px%3B%26nbsp%3Bborder%3A%26nbsp%3B0px%3B%26nbsp%3Bfont-family%3A%26nbsp%3BHelvetica%2C%26nbsp%3BArial%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3Bline-height%3A%26nbsp%3B16px%3B%26nbsp%3Bvertical-align%3A%26nbsp%3Bbaseline%3B%26nbsp%3Bmax-width%3A%26nbsp%3B665px%3B%26nbsp%3Bcolor%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%22%3Eand%26nbsp%3Bhas%26nbsp%3Bto%26nbsp%3Bwrite%26nbsp%3Bprogram%26nbsp%3Bin%26nbsp%3Bc%26nbsp%3B.%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22c1%22%26nbsp%3Bstyle%3D%22margin-right%3A%26nbsp%3B0px%3B%26nbsp%3Bmargin-bottom%3A%26nbsp%3B0.5em%3B%26nbsp%3Bmargin-left%3A%26nbsp%3B0px%3B%26nbsp%3Bpadding%3A%26nbsp%3B0px%3B%26nbsp%3Bborder%3A%26nbsp%3B0px%3B%26nbsp%3Bfont-family%3A%26nbsp%3BHelvetica%2C%26nbsp%3BArial%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3Bline-height%3A%26nbsp%3B16px%3B%26nbsp%3Bvertical-align%3A%26nbsp%3Bbaseline%3B%26nbsp%3Bmax-width%3A%26nbsp%3B665px%3B%26nbsp%3Bcolor%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%22%3Eand%26nbsp%3Bit%26nbsp%3Bhas%26nbsp%3Bto%26nbsp%3Brun%26nbsp%3Bwith%26nbsp%3Bunix%26nbsp%3Band%26nbsp%3Busin%26nbsp%3Band%26nbsp%3Bdiff%26nbsp%3Bcommand.%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22c1%22%26nbsp%3Bstyle%3D%22margin-right%3A%26nbsp%3B0px%3B%26nbsp%3Bmargin-bottom%3A%26nbsp%3B0.5em%3B%26nbsp%3Bmargin-left%3A%26nbsp%3B0px%3B%26nbsp%3Bpadding%3A%26nbsp%3B0px%3B%26nbsp%3Bborder%3A%26nbsp%3B0px%3B%26nbsp%3Bfont-family%3A%26nbsp%3BHelvetica%2C%26nbsp%3BArial%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3Bline-height%3A%26nbsp%3B16px%3B%26nbsp%3Bvertical-align%3A%26nbsp%3Bbaseline%3B%26nbsp%3Bmax-width%3A%26nbsp%3B665px%3B%26nbsp%3Bcolor%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%22%3E%3Cbr%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22c1%22%26nbsp%3Bstyle%3D%22margin-right%3A%26nbsp%3B0px%3B%26nbsp%3Bmargin-bottom%3A%26nbsp%3B0.5em%3B%26nbsp%3Bmargin-left%3A%26nbsp%3B0px%3B%26nbsp%3Bpadding%3A%26nbsp%3B0px%3B%26nbsp%3Bborder%3A%26nbsp%3B0px%3B%26nbsp%3Bfont-family%3A%26nbsp%3BHelvetica%2C%26nbsp%3BArial%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3Bline-height%3A%26nbsp%3B16px%3B%26nbsp%3Bvertical-align%3A%26nbsp%3Bbaseline%3B%26nbsp%3Bmax-width%3A%26nbsp%3B665px%3B%26nbsp%3Bcolor%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%22%3Ehas%26nbsp%3Bto%26nbsp%3Buse%26nbsp%3Bc%26nbsp%3Blang%26nbsp%3Band%26nbsp%3Brunning%26nbsp%3Bwith%26nbsp%3Bunix%26nbsp%3B(diff%26nbsp%3Bcommand)%3C%2Fp%3E

Explanation / Answer

#include<stdio.h>

int main()
{
    FILE *fp1, *fp2;
    int ch1, ch2;
    char fname1[40], fname2[40] ;
    printf("Enter name of first file :") ;
    gets(fname1);
    printf("Enter name of second file:");
    gets(fname2);
    fp1 = fopen( fname1, "r" );
    fp2 = fopen( fname2, "r" ) ;
    if ( fp1 == NULL )
       {
       printf("Cannot open %s for reading ", fname1 );
       exit(1);
       }
    else if (fp2 == NULL)
       {
       printf("Cannot open %s for reading ", fname2 );
       exit(1);
       }
    else
       {
       ch1 = getc( fp1 ) ;
       ch2 = getc( fp2 ) ;
       while( (ch1!=EOF) && (ch2!=EOF) && (ch1 == ch2))
        {
            ch1 = getc(fp1);
            ch2 = getc(fp2) ;
        }

        if (ch1 == ch2)
            printf("Files are identical n");
        else if (ch1 != ch2)
            printf("Files are Not identical n");
        fclose ( fp1 );
        fclose ( fp2 );
       }
return(0);
}



this will help u it will run on unix