|
-
June 11th, 2012, 11:27 PM
#1
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...
-
June 11th, 2012, 11:58 PM
#2
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
-
June 12th, 2012, 12:00 AM
#3
Re: pls Help...
Besides this is the way how you should declare abc function properly:
Code:
void abc(struct sss s)
{
printf("%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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|