argv[1] not recognised outside of main
Hi
This is a C programming question. I have a function that gets called from main. In the definition of the function i use getaddrinfo. One of getaddrinfo's arguments is argv[1]. Because this function is defined outside of main, gcc complains that this function doesn't know what argv[1] is. I put the networking code in this function in question because sendto(this is a UDP client) doesn't know what the res structure is if i put it in main. Do i pass *argv[] as an argument to this function in question or what?
I can post the code if you want.
thank you very much for your time.
Last edited by methodtwo; 01-02-2013 at 09:35 AM.
|