Thread: int = char ??????

  1. #1
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,071

    int = char ??????

    char szSTRING1[]="test";
    int length=szSTRING1;

    thats my current code...but my compiler (dev c++) says

    initilazation to 'int' from 'char*' lacks a cast

    what does that mean...or how do i make a int variable equal the length of a char variable???

    thanks ahead of time
    -psychopath

  2. #2
    Registered User
    Join Date
    Mar 2004
    Posts
    536
    Code:
    #include <cstring>
    
    // other stuff
    
    int main()
    {
    // other stuff
    
      length = strlen(szSTRING1);
    
    //other stuff
    }

    Dave

  3. #3
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,071
    k thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  2. can some one please tell me the cause of the error ?
    By broli86 in forum C Programming
    Replies: 8
    Last Post: 06-26-2008, 08:36 PM
  3. Replies: 14
    Last Post: 06-28-2006, 01:58 AM
  4. Game Won't Compile
    By jothesmo in forum C++ Programming
    Replies: 2
    Last Post: 04-01-2006, 04:24 PM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM