Conditional jump or move depends on uninitialized value(s) when checking with if condition












-1














int t_parse(char* target, FILE* fp) 
{
char cuts = ':';
char * tok;
char ln[BUFF_SIZE];

if (lnCnt == 0)
{
lnCnt = 1;
}

while (!feof(fp))
{
int i = 0;
int hop = 1;
char c;
while (hop)
{
c = fgetc(fp);
if (feof(fp))
{
if (i == 0)
{
return 0;
}
ln[i] = '';
hop = 0;
}
else if (c == 'n')
{
ln[i] = '';
hop = 0;
}
else if (i == BUFF_SIZE)
{
fprintf(stderr, "%i: Error of long linen", lnCnt);
exit(1);
}
if (hop)
{
ln[i] = c;
}
i++;
}

if (ln[0] != '#' && ln[0] != 't' && ln[0] != '')
{
tok = strtok(ln, &cuts);
if (tok == NULL)
{
fprintf(stderr, "%d: Error of invalid targetn", lnCnt);
exit(1);
}
else
{
strcpy(target, tok);

for (int j = 0; j < BUFF_SIZE; j++)
{
if (target[j] == ' ')
{
target[j] = '';
return lnCnt++;
}
}
return lnCnt++;
}
}
lnCnt++;
}
return 0;
}


After running Valgrind Conditional jump or move depends on uninitialized value(s)
==2469== at 0x10938F: t_parse (text_parsing.c:81)



Which is
else
{
strcpy(target, tok);



            for (int j = 0; j < BUFF_SIZE; j++) 
{
if (target[j] == ' ')
{
target[j] = '';
return lnCnt++;
}


line 81 is if (target[j] == ' ')
I am check here so I am not sure why is there a memory leak?
i ran the command valgrind --leak-check=yes --track-origins=yes --read-var-info=yes 537make










share|improve this question



























    -1














    int t_parse(char* target, FILE* fp) 
    {
    char cuts = ':';
    char * tok;
    char ln[BUFF_SIZE];

    if (lnCnt == 0)
    {
    lnCnt = 1;
    }

    while (!feof(fp))
    {
    int i = 0;
    int hop = 1;
    char c;
    while (hop)
    {
    c = fgetc(fp);
    if (feof(fp))
    {
    if (i == 0)
    {
    return 0;
    }
    ln[i] = '';
    hop = 0;
    }
    else if (c == 'n')
    {
    ln[i] = '';
    hop = 0;
    }
    else if (i == BUFF_SIZE)
    {
    fprintf(stderr, "%i: Error of long linen", lnCnt);
    exit(1);
    }
    if (hop)
    {
    ln[i] = c;
    }
    i++;
    }

    if (ln[0] != '#' && ln[0] != 't' && ln[0] != '')
    {
    tok = strtok(ln, &cuts);
    if (tok == NULL)
    {
    fprintf(stderr, "%d: Error of invalid targetn", lnCnt);
    exit(1);
    }
    else
    {
    strcpy(target, tok);

    for (int j = 0; j < BUFF_SIZE; j++)
    {
    if (target[j] == ' ')
    {
    target[j] = '';
    return lnCnt++;
    }
    }
    return lnCnt++;
    }
    }
    lnCnt++;
    }
    return 0;
    }


    After running Valgrind Conditional jump or move depends on uninitialized value(s)
    ==2469== at 0x10938F: t_parse (text_parsing.c:81)



    Which is
    else
    {
    strcpy(target, tok);



                for (int j = 0; j < BUFF_SIZE; j++) 
    {
    if (target[j] == ' ')
    {
    target[j] = '';
    return lnCnt++;
    }


    line 81 is if (target[j] == ' ')
    I am check here so I am not sure why is there a memory leak?
    i ran the command valgrind --leak-check=yes --track-origins=yes --read-var-info=yes 537make










    share|improve this question

























      -1












      -1








      -1







      int t_parse(char* target, FILE* fp) 
      {
      char cuts = ':';
      char * tok;
      char ln[BUFF_SIZE];

      if (lnCnt == 0)
      {
      lnCnt = 1;
      }

      while (!feof(fp))
      {
      int i = 0;
      int hop = 1;
      char c;
      while (hop)
      {
      c = fgetc(fp);
      if (feof(fp))
      {
      if (i == 0)
      {
      return 0;
      }
      ln[i] = '';
      hop = 0;
      }
      else if (c == 'n')
      {
      ln[i] = '';
      hop = 0;
      }
      else if (i == BUFF_SIZE)
      {
      fprintf(stderr, "%i: Error of long linen", lnCnt);
      exit(1);
      }
      if (hop)
      {
      ln[i] = c;
      }
      i++;
      }

      if (ln[0] != '#' && ln[0] != 't' && ln[0] != '')
      {
      tok = strtok(ln, &cuts);
      if (tok == NULL)
      {
      fprintf(stderr, "%d: Error of invalid targetn", lnCnt);
      exit(1);
      }
      else
      {
      strcpy(target, tok);

      for (int j = 0; j < BUFF_SIZE; j++)
      {
      if (target[j] == ' ')
      {
      target[j] = '';
      return lnCnt++;
      }
      }
      return lnCnt++;
      }
      }
      lnCnt++;
      }
      return 0;
      }


      After running Valgrind Conditional jump or move depends on uninitialized value(s)
      ==2469== at 0x10938F: t_parse (text_parsing.c:81)



      Which is
      else
      {
      strcpy(target, tok);



                  for (int j = 0; j < BUFF_SIZE; j++) 
      {
      if (target[j] == ' ')
      {
      target[j] = '';
      return lnCnt++;
      }


      line 81 is if (target[j] == ' ')
      I am check here so I am not sure why is there a memory leak?
      i ran the command valgrind --leak-check=yes --track-origins=yes --read-var-info=yes 537make










      share|improve this question













      int t_parse(char* target, FILE* fp) 
      {
      char cuts = ':';
      char * tok;
      char ln[BUFF_SIZE];

      if (lnCnt == 0)
      {
      lnCnt = 1;
      }

      while (!feof(fp))
      {
      int i = 0;
      int hop = 1;
      char c;
      while (hop)
      {
      c = fgetc(fp);
      if (feof(fp))
      {
      if (i == 0)
      {
      return 0;
      }
      ln[i] = '';
      hop = 0;
      }
      else if (c == 'n')
      {
      ln[i] = '';
      hop = 0;
      }
      else if (i == BUFF_SIZE)
      {
      fprintf(stderr, "%i: Error of long linen", lnCnt);
      exit(1);
      }
      if (hop)
      {
      ln[i] = c;
      }
      i++;
      }

      if (ln[0] != '#' && ln[0] != 't' && ln[0] != '')
      {
      tok = strtok(ln, &cuts);
      if (tok == NULL)
      {
      fprintf(stderr, "%d: Error of invalid targetn", lnCnt);
      exit(1);
      }
      else
      {
      strcpy(target, tok);

      for (int j = 0; j < BUFF_SIZE; j++)
      {
      if (target[j] == ' ')
      {
      target[j] = '';
      return lnCnt++;
      }
      }
      return lnCnt++;
      }
      }
      lnCnt++;
      }
      return 0;
      }


      After running Valgrind Conditional jump or move depends on uninitialized value(s)
      ==2469== at 0x10938F: t_parse (text_parsing.c:81)



      Which is
      else
      {
      strcpy(target, tok);



                  for (int j = 0; j < BUFF_SIZE; j++) 
      {
      if (target[j] == ' ')
      {
      target[j] = '';
      return lnCnt++;
      }


      line 81 is if (target[j] == ' ')
      I am check here so I am not sure why is there a memory leak?
      i ran the command valgrind --leak-check=yes --track-origins=yes --read-var-info=yes 537make







      c valgrind






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 at 0:31









      Ray

      31




      31
























          2 Answers
          2






          active

          oldest

          votes


















          0














          tok is string copied into target. It will be terminated with a '' character.



          Then you are looping through the characters in target, and will terminate on a matching space character. However, you are moving beyond the end of the string in target in the case when no space character is found, which is uninitialised and could contain anything--so valgrind warns you of this.



          One other issue: char *strtok(char *str, const char *delim); In this, delim points to a string of delimiters, not a single character. So char cuts = ':'; should be char *cuts = ":";






          share|improve this answer























          • How do you suggest I fix it? I tried to initialize target bu using a for loop. ............... for (int j = 0; j < BUFF_SIZE; j++) { (target[j] == 'a'); }................... I tried target = & char var. ......... No luck
            – Ray
            Nov 13 at 1:52










          • You cannot say: target[j] == 'a'; == is the equality operator. You need the assignment operator =
            – Rob Newton
            Nov 13 at 1:55










          • Sorry, my bad. Tried .... for (int j = 0; j < BUFF_SIZE; j++) { target[j] = 'a'; }..... Still same error
            – Ray
            Nov 13 at 2:05










          • I am surprised you would get that same exact valgrind warning after initialising the buffer, unless you are copying in unitialised data from the strcpy() further up; yes, that may be the problem? Also refer to my edited answer.
            – Rob Newton
            Nov 13 at 2:21










          • after the strcpy(), it would be interesting to printf() target, to see if it is ok according to valgrind
            – Rob Newton
            Nov 13 at 2:27



















          0














          valgrind is not saying anything about a leak. It is showing off another of its features. It has detected that you are testing the content of memory that you did not initialize. It means that target contains undefined data. If you want more detailed answer you have to show how you set up target






          share|improve this answer





















          • i declared int t_parse(char* target, FILE* fp) and then i strcpy(target, tok); I have not used target anywhere else
            – Ray
            Nov 13 at 0:50










          • you need to show where you set it up in the code that calls t_parse, you passed it in as the first parameter
            – pm100
            Nov 13 at 0:56






          • 1




            the probable cause is that you are looping for BUF_SIZE bytes, you should probably be only looping till strlen(target)
            – pm100
            Nov 13 at 0:58










          • I have tried initializing target to a char. I have tried for (int j = 0; j < BUFF_SIZE; j++) { (target[j] == 'a'); } at the beginning of the function. Still dosent work. I tried changing the for loop at line 80 to strlen(target). No luck
            – Ray
            Nov 13 at 1:48













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53272088%2fconditional-jump-or-move-depends-on-uninitialized-values-when-checking-with-if%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          tok is string copied into target. It will be terminated with a '' character.



          Then you are looping through the characters in target, and will terminate on a matching space character. However, you are moving beyond the end of the string in target in the case when no space character is found, which is uninitialised and could contain anything--so valgrind warns you of this.



          One other issue: char *strtok(char *str, const char *delim); In this, delim points to a string of delimiters, not a single character. So char cuts = ':'; should be char *cuts = ":";






          share|improve this answer























          • How do you suggest I fix it? I tried to initialize target bu using a for loop. ............... for (int j = 0; j < BUFF_SIZE; j++) { (target[j] == 'a'); }................... I tried target = & char var. ......... No luck
            – Ray
            Nov 13 at 1:52










          • You cannot say: target[j] == 'a'; == is the equality operator. You need the assignment operator =
            – Rob Newton
            Nov 13 at 1:55










          • Sorry, my bad. Tried .... for (int j = 0; j < BUFF_SIZE; j++) { target[j] = 'a'; }..... Still same error
            – Ray
            Nov 13 at 2:05










          • I am surprised you would get that same exact valgrind warning after initialising the buffer, unless you are copying in unitialised data from the strcpy() further up; yes, that may be the problem? Also refer to my edited answer.
            – Rob Newton
            Nov 13 at 2:21










          • after the strcpy(), it would be interesting to printf() target, to see if it is ok according to valgrind
            – Rob Newton
            Nov 13 at 2:27
















          0














          tok is string copied into target. It will be terminated with a '' character.



          Then you are looping through the characters in target, and will terminate on a matching space character. However, you are moving beyond the end of the string in target in the case when no space character is found, which is uninitialised and could contain anything--so valgrind warns you of this.



          One other issue: char *strtok(char *str, const char *delim); In this, delim points to a string of delimiters, not a single character. So char cuts = ':'; should be char *cuts = ":";






          share|improve this answer























          • How do you suggest I fix it? I tried to initialize target bu using a for loop. ............... for (int j = 0; j < BUFF_SIZE; j++) { (target[j] == 'a'); }................... I tried target = & char var. ......... No luck
            – Ray
            Nov 13 at 1:52










          • You cannot say: target[j] == 'a'; == is the equality operator. You need the assignment operator =
            – Rob Newton
            Nov 13 at 1:55










          • Sorry, my bad. Tried .... for (int j = 0; j < BUFF_SIZE; j++) { target[j] = 'a'; }..... Still same error
            – Ray
            Nov 13 at 2:05










          • I am surprised you would get that same exact valgrind warning after initialising the buffer, unless you are copying in unitialised data from the strcpy() further up; yes, that may be the problem? Also refer to my edited answer.
            – Rob Newton
            Nov 13 at 2:21










          • after the strcpy(), it would be interesting to printf() target, to see if it is ok according to valgrind
            – Rob Newton
            Nov 13 at 2:27














          0












          0








          0






          tok is string copied into target. It will be terminated with a '' character.



          Then you are looping through the characters in target, and will terminate on a matching space character. However, you are moving beyond the end of the string in target in the case when no space character is found, which is uninitialised and could contain anything--so valgrind warns you of this.



          One other issue: char *strtok(char *str, const char *delim); In this, delim points to a string of delimiters, not a single character. So char cuts = ':'; should be char *cuts = ":";






          share|improve this answer














          tok is string copied into target. It will be terminated with a '' character.



          Then you are looping through the characters in target, and will terminate on a matching space character. However, you are moving beyond the end of the string in target in the case when no space character is found, which is uninitialised and could contain anything--so valgrind warns you of this.



          One other issue: char *strtok(char *str, const char *delim); In this, delim points to a string of delimiters, not a single character. So char cuts = ':'; should be char *cuts = ":";







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 13 at 2:19

























          answered Nov 13 at 0:45









          Rob Newton

          37028




          37028












          • How do you suggest I fix it? I tried to initialize target bu using a for loop. ............... for (int j = 0; j < BUFF_SIZE; j++) { (target[j] == 'a'); }................... I tried target = & char var. ......... No luck
            – Ray
            Nov 13 at 1:52










          • You cannot say: target[j] == 'a'; == is the equality operator. You need the assignment operator =
            – Rob Newton
            Nov 13 at 1:55










          • Sorry, my bad. Tried .... for (int j = 0; j < BUFF_SIZE; j++) { target[j] = 'a'; }..... Still same error
            – Ray
            Nov 13 at 2:05










          • I am surprised you would get that same exact valgrind warning after initialising the buffer, unless you are copying in unitialised data from the strcpy() further up; yes, that may be the problem? Also refer to my edited answer.
            – Rob Newton
            Nov 13 at 2:21










          • after the strcpy(), it would be interesting to printf() target, to see if it is ok according to valgrind
            – Rob Newton
            Nov 13 at 2:27


















          • How do you suggest I fix it? I tried to initialize target bu using a for loop. ............... for (int j = 0; j < BUFF_SIZE; j++) { (target[j] == 'a'); }................... I tried target = & char var. ......... No luck
            – Ray
            Nov 13 at 1:52










          • You cannot say: target[j] == 'a'; == is the equality operator. You need the assignment operator =
            – Rob Newton
            Nov 13 at 1:55










          • Sorry, my bad. Tried .... for (int j = 0; j < BUFF_SIZE; j++) { target[j] = 'a'; }..... Still same error
            – Ray
            Nov 13 at 2:05










          • I am surprised you would get that same exact valgrind warning after initialising the buffer, unless you are copying in unitialised data from the strcpy() further up; yes, that may be the problem? Also refer to my edited answer.
            – Rob Newton
            Nov 13 at 2:21










          • after the strcpy(), it would be interesting to printf() target, to see if it is ok according to valgrind
            – Rob Newton
            Nov 13 at 2:27
















          How do you suggest I fix it? I tried to initialize target bu using a for loop. ............... for (int j = 0; j < BUFF_SIZE; j++) { (target[j] == 'a'); }................... I tried target = & char var. ......... No luck
          – Ray
          Nov 13 at 1:52




          How do you suggest I fix it? I tried to initialize target bu using a for loop. ............... for (int j = 0; j < BUFF_SIZE; j++) { (target[j] == 'a'); }................... I tried target = & char var. ......... No luck
          – Ray
          Nov 13 at 1:52












          You cannot say: target[j] == 'a'; == is the equality operator. You need the assignment operator =
          – Rob Newton
          Nov 13 at 1:55




          You cannot say: target[j] == 'a'; == is the equality operator. You need the assignment operator =
          – Rob Newton
          Nov 13 at 1:55












          Sorry, my bad. Tried .... for (int j = 0; j < BUFF_SIZE; j++) { target[j] = 'a'; }..... Still same error
          – Ray
          Nov 13 at 2:05




          Sorry, my bad. Tried .... for (int j = 0; j < BUFF_SIZE; j++) { target[j] = 'a'; }..... Still same error
          – Ray
          Nov 13 at 2:05












          I am surprised you would get that same exact valgrind warning after initialising the buffer, unless you are copying in unitialised data from the strcpy() further up; yes, that may be the problem? Also refer to my edited answer.
          – Rob Newton
          Nov 13 at 2:21




          I am surprised you would get that same exact valgrind warning after initialising the buffer, unless you are copying in unitialised data from the strcpy() further up; yes, that may be the problem? Also refer to my edited answer.
          – Rob Newton
          Nov 13 at 2:21












          after the strcpy(), it would be interesting to printf() target, to see if it is ok according to valgrind
          – Rob Newton
          Nov 13 at 2:27




          after the strcpy(), it would be interesting to printf() target, to see if it is ok according to valgrind
          – Rob Newton
          Nov 13 at 2:27













          0














          valgrind is not saying anything about a leak. It is showing off another of its features. It has detected that you are testing the content of memory that you did not initialize. It means that target contains undefined data. If you want more detailed answer you have to show how you set up target






          share|improve this answer





















          • i declared int t_parse(char* target, FILE* fp) and then i strcpy(target, tok); I have not used target anywhere else
            – Ray
            Nov 13 at 0:50










          • you need to show where you set it up in the code that calls t_parse, you passed it in as the first parameter
            – pm100
            Nov 13 at 0:56






          • 1




            the probable cause is that you are looping for BUF_SIZE bytes, you should probably be only looping till strlen(target)
            – pm100
            Nov 13 at 0:58










          • I have tried initializing target to a char. I have tried for (int j = 0; j < BUFF_SIZE; j++) { (target[j] == 'a'); } at the beginning of the function. Still dosent work. I tried changing the for loop at line 80 to strlen(target). No luck
            – Ray
            Nov 13 at 1:48


















          0














          valgrind is not saying anything about a leak. It is showing off another of its features. It has detected that you are testing the content of memory that you did not initialize. It means that target contains undefined data. If you want more detailed answer you have to show how you set up target






          share|improve this answer





















          • i declared int t_parse(char* target, FILE* fp) and then i strcpy(target, tok); I have not used target anywhere else
            – Ray
            Nov 13 at 0:50










          • you need to show where you set it up in the code that calls t_parse, you passed it in as the first parameter
            – pm100
            Nov 13 at 0:56






          • 1




            the probable cause is that you are looping for BUF_SIZE bytes, you should probably be only looping till strlen(target)
            – pm100
            Nov 13 at 0:58










          • I have tried initializing target to a char. I have tried for (int j = 0; j < BUFF_SIZE; j++) { (target[j] == 'a'); } at the beginning of the function. Still dosent work. I tried changing the for loop at line 80 to strlen(target). No luck
            – Ray
            Nov 13 at 1:48
















          0












          0








          0






          valgrind is not saying anything about a leak. It is showing off another of its features. It has detected that you are testing the content of memory that you did not initialize. It means that target contains undefined data. If you want more detailed answer you have to show how you set up target






          share|improve this answer












          valgrind is not saying anything about a leak. It is showing off another of its features. It has detected that you are testing the content of memory that you did not initialize. It means that target contains undefined data. If you want more detailed answer you have to show how you set up target







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 at 0:36









          pm100

          25k1557104




          25k1557104












          • i declared int t_parse(char* target, FILE* fp) and then i strcpy(target, tok); I have not used target anywhere else
            – Ray
            Nov 13 at 0:50










          • you need to show where you set it up in the code that calls t_parse, you passed it in as the first parameter
            – pm100
            Nov 13 at 0:56






          • 1




            the probable cause is that you are looping for BUF_SIZE bytes, you should probably be only looping till strlen(target)
            – pm100
            Nov 13 at 0:58










          • I have tried initializing target to a char. I have tried for (int j = 0; j < BUFF_SIZE; j++) { (target[j] == 'a'); } at the beginning of the function. Still dosent work. I tried changing the for loop at line 80 to strlen(target). No luck
            – Ray
            Nov 13 at 1:48




















          • i declared int t_parse(char* target, FILE* fp) and then i strcpy(target, tok); I have not used target anywhere else
            – Ray
            Nov 13 at 0:50










          • you need to show where you set it up in the code that calls t_parse, you passed it in as the first parameter
            – pm100
            Nov 13 at 0:56






          • 1




            the probable cause is that you are looping for BUF_SIZE bytes, you should probably be only looping till strlen(target)
            – pm100
            Nov 13 at 0:58










          • I have tried initializing target to a char. I have tried for (int j = 0; j < BUFF_SIZE; j++) { (target[j] == 'a'); } at the beginning of the function. Still dosent work. I tried changing the for loop at line 80 to strlen(target). No luck
            – Ray
            Nov 13 at 1:48


















          i declared int t_parse(char* target, FILE* fp) and then i strcpy(target, tok); I have not used target anywhere else
          – Ray
          Nov 13 at 0:50




          i declared int t_parse(char* target, FILE* fp) and then i strcpy(target, tok); I have not used target anywhere else
          – Ray
          Nov 13 at 0:50












          you need to show where you set it up in the code that calls t_parse, you passed it in as the first parameter
          – pm100
          Nov 13 at 0:56




          you need to show where you set it up in the code that calls t_parse, you passed it in as the first parameter
          – pm100
          Nov 13 at 0:56




          1




          1




          the probable cause is that you are looping for BUF_SIZE bytes, you should probably be only looping till strlen(target)
          – pm100
          Nov 13 at 0:58




          the probable cause is that you are looping for BUF_SIZE bytes, you should probably be only looping till strlen(target)
          – pm100
          Nov 13 at 0:58












          I have tried initializing target to a char. I have tried for (int j = 0; j < BUFF_SIZE; j++) { (target[j] == 'a'); } at the beginning of the function. Still dosent work. I tried changing the for loop at line 80 to strlen(target). No luck
          – Ray
          Nov 13 at 1:48






          I have tried initializing target to a char. I have tried for (int j = 0; j < BUFF_SIZE; j++) { (target[j] == 'a'); } at the beginning of the function. Still dosent work. I tried changing the for loop at line 80 to strlen(target). No luck
          – Ray
          Nov 13 at 1:48




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53272088%2fconditional-jump-or-move-depends-on-uninitialized-values-when-checking-with-if%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to pass form data using jquery Ajax to insert data in database?

          National Museum of Racing and Hall of Fame

          Guess what letter conforming each word