CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    Join Date
    Jun 2002
    Posts
    137

    Re: Is this valid initialize of char []

    Thanks, but I tried to init den as following, and I changed the arguments type of const_str1 & const_str2 to const char*

    const char* dent[] = {const_str1, const_str2};

    the compiler reports (sorry not to give the compiler type, it is cc in HP Unix server):
    cc: error 1521: Incorrect initialization.

  2. #17
    Join Date
    Dec 2005
    Posts
    642

    Re: Is this valid initialize of char []

    Quote Originally Posted by sandodo
    Code:
    char const_str[] = "a test";
    
    char* dent[] = {const_str};
    The problem is that const_str1, const_str2 are passed into the function as char* type arguments.
    That's not a problem. A function with formal parameter of type pointer can always take a compatibly typed array as an actual parameter.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured