CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: pls Help...

  1. #1
    Join Date
    Feb 2012
    Location
    INDIA
    Posts
    25

    pls Help...

    include <stdio.h>

    void abc(struct sss );


    void main()
    {
    struct sss
    {
    int i;
    char j;

    };

    struct sss s = {1, 'a'};

    abc(s);// error in this line...

    }


    abc(struct sss s)
    {
    printf("%d %c", s.i, s.j);
    }

    compiler Error:- 'abc' : cannot convert parameter 1 from 'struct main::sss' to 'struct sss'

    What's the error about, why this error has occured...??? struct main:: sss means ???
    TANUSHREE-AGRAWAL...

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: pls Help...

    struct main:: sss means ???
    This literally means: struct sss declared in the scope of main. The declaration visibility is limited by its scope. You should make it global, why you did not?
    Best regards,
    Igor

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: pls Help...

    Besides this is the way how you should declare abc function properly:
    Code:
    void abc(struct sss s)
    {
    printf("&#37;d %c", s.i, s.j);
    }
    Best regards,
    Igor

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