Need help passing a Struct to a function locally in C -


Creating a simple program related to strings is quite easy, but for some reason, Can not understand how to pass enough. I have declared in my main () structure that I have been impressed by searching on this site that the only way to do this is to create a header file and make that kind of announcement. is it true?

  main () {struct rect {double x; Double wi; Four colors; Double width; Double height; }; RT, A, B, * REC;  

And this is where I am trying to pass it:

  int chk_overlap (struct rect * r1, struct rect * r2) {If (((r1-> x + r1- & gt; width)> = r2- & gt; x) & amp; amp; ((r1- & gt; y)> = (r1 -> y - r2-> height))) {return 1; } And {return 0; }}  

This is just a trend of my attempt, when I pass it like this, I get a dereferencing for incomplete indicator error. I have also tried to declare it

  typedef struct rect {double x; Double wi; Four colors; Double width; Double height; } Rectangle; Recap A, B, * REC;  

It is passing as

  int chk_overlap (rect * r1, rect * r2) {}  
< P> Edit: This is where I'm actually using the function

  int check = 0; Czech = check + chk_overlap (& a, & amp; b);  

You must declare the structure before the main.

  straight cut {double x; Double wi; Four colors; Double width; Double height; } * * Function definitions * / int main (int argi, four * argv []) (* struct; rect a, b; * rec; ...} / * here function code * /  < / Pre> 

Since you are announcing it outside of Main () , it has not been seen outside, hence the function don

In addition, the way You are calling function ( function (& amp; a, & amp; b) ).


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -