<br><br><div class="gmail_quote">On Fri, Jan 15, 2010 at 4:03 PM, Christopher Howard <span dir="ltr"><<a href="mailto:choward@indicium.us">choward@indicium.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">Paul Otheim wrote:<br>
<br>
> gcc -o insert insertEntry.c<br>
> insertEntry.c:8: warning: ‘struct entry’ declared inside parameter list<br>
> insertEntry.c:8: warning: its scope is only this definition or<br>
> declaration, which is probably not what you want<br>
> insertEntry.c: In function ‘main’:<br>
> insertEntry.c:20: error: conflicting types for ‘insertEntry’<br>
> insertEntry.c:8: note: previous definition of ‘insertEntry’ was here<br>
><br>
><br>
> void insertEntry (struct entry *new, struct entry *here) //this is line 8<br>
> {<br>
> .....<br>
> }<br>
><br>
> int main (void)<br>
> {<br>
> void insertEntry (struct entry *new, struct entry *here); // this is<br>
> line 20<br>
><br>
> ......<br>
> }<br>
><br>
<br>
</div>No, the prototype for your function doesn't go inside another function.<br>
(Main is a function.)<br>
<br>
If you have declared insertEntry() in the same file, previous to the<br>
place where you intend to use it, you don't actually need a function<br>
prototype. Function prototypes are for if you want to use a function<br>
before you have actually defined what it does internally. Function<br>
prototypes usually go in header files.<br>
<br>
It also appears that you have not coded a definition for "struct entry"<br>
before line 8, which is confusing the compiler. See any tutorial on C<br>
structs.<br>
<font color="#888888"></font><br></blockquote><div><br> Do you hear that? It's the sound of me kicking myself!<br>Thanks for your help. Just to clarify. I had declared struct entry in main() being under the impression for some reason that it would then be available to all functions. So if I understand correctly I have to declare it outside of main() which makes it a global definition. Would it then be global to all files linked to this file?<br>
</div></div>