Generating Bitstream_Showing Compilation Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Thaushikan
    New Member
    • Mar 2017
    • 1

    Generating Bitstream_Showing Compilation Error

    Hello,

    Algorithm: Generating Bitstream (for e.g., 0`s and 1`s)

    While compiling this program its showing compiling error. Looking over my program , point out whats wrong in the following codes.

    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    int bin_verify(char[]);
    int main()
    {
    char bin1[33],bin2[33],result[33];
    int len1, lens2,check;
    printf("Enter binary number 1:");
    scanf ("%s", bin1);
    printf("Enter binary number 2:");
    scanf ("%s", bin2);
    check=bin_verif y(bin1);
    if(check)
    {
    printf("Invalid binary number%s.\n", bin1);
    exit(0);
    }
    check =bin_verify(bin 2);
    if(check)
    {
    printf("Invalid binary number%s.\n", bin2);
    exit(0);
    }
    printf("output binary %s.\n", bin1);
    printf("output binary %s.\n", bin2);
    return 0;
    }
    int bin_verify(char str[])
    {
    int i;
    for (i=0;i<strlen(s tr);i++)
    {
    if((str[i]-'0'!=1)&&(str[i]-'0!=0'))
    {
    return 1;

    }
    }
    return 0;
    }
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    Please provide the text of the compiler error.
    Compiler errors typically contain a line number. Which line of your program corresponds to the line number?

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      Other than a couple of unused variables, all I can see is:

      Code:
      for (i=0;i<strlen(str);i++)
      etc...
      where int i is signed and strlen() returns a size_t which is unsigned. But even this would be just a warning not an actual error.

      What error are you talking about?

      Comment

      Working...