Thread: Error with strcmp

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    26

    Error with strcmp

    I have this function
    Code:
    void verifyMatrix(int n, int m, char *orig, char **mat)
    {
          char verifyString[5];
          int k;
          k=0;
        // Creating a string
            for (int i=n; i<(n+DIM); i++)
     for (int j=m; j<(m+DIM); j++)
     {
        verifyString[k] = mat [i] [j];
        k++;
     }
     verifyString[4] = '\0';
        if (strcmp(orig, verifyString) = 0)
            tmpMat[n][m] = orig[0];
    return;
    }
    the function without the strcmp construnct work; with strcmp I have in compilation this error:
    error C2106: '=': left operator must be an I-value
    origin is an array declared as
    char firstString[5];
    tmpMat is a matrix declared as
    char **tmpMat; and allocated as dinamic.
    How is my error ? I hope in your help.
    Thank you and best regards.

    Nino

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> strcmp(orig, verifyString) = 0
    Are you sure you want '=' there?

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    26
    Quote Originally Posted by Daved
    >> strcmp(orig, verifyString) = 0
    Are you sure you want '=' there?
    Sorry,
    but I have worked a lot and I am tired. The eyes close and also the brain.

    Thank You.

    Nimo

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    Is it Nino or Nimo?

  5. #5
    Registered User
    Join Date
    Nov 2006
    Posts
    26
    Nino. It is a lapsus

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fucntion returns -1, Why?
    By Taper in forum C Programming
    Replies: 16
    Last Post: 12-08-2008, 06:30 PM
  2. help with switch statement
    By agentsmith in forum C Programming
    Replies: 11
    Last Post: 08-26-2008, 04:02 PM
  3. problem with strings
    By agentsmith in forum C Programming
    Replies: 5
    Last Post: 04-08-2008, 12:07 PM
  4. help with strcmp
    By blork_98 in forum C Programming
    Replies: 8
    Last Post: 02-21-2006, 08:23 PM
  5. strcmp
    By kryonik in forum C Programming
    Replies: 9
    Last Post: 10-11-2005, 11:04 AM