struct & global variable

Andrew Haley aph@redhat.com
Sat Sep 26 08:29:00 GMT 2009


Mohsen Pahlevanzadeh wrote:
> Dear all,
> i have a struct & 3 pointer to it.
> i defined them global.but i can't access globaly.
> //////////////////////////////////////////////////////////////////
> struct linked_list{
>                         int ii;
>                         const char * srcip;
>                         const char * dstip;
>                         const char * hostname;
>                         char * url;
>                         char * date;
>                         char * username;
>                         struct linked_list *next;
>                         struct linked_list *previous;
>                       };//end of struct
> static struct linked_list *last,*start;
> int filling_node(char * srcip,char * dstip,char * hostname,char * url
> ,char * date,char * username){
> ptr = new_node();
> ptr->srcip = srcip;
> .
> .
> .
> ptr->username = username;
> }
> void func2(){
> filling_node("213.217.60.13","80.90.100.71","google.com","http://google.com/?lkfj=lf","02-21-99","mohsen");
> 
> }
> //////////////////////////////////////////////////////////////////
> 
> 
> But my code doesn't print anything.But, when i use my printf in
> filling_node func, i see result.So,i guess this related to global var.
> help me please.....

We can't because you haven't given us a program that we can compile and
run.

Andrew.




More information about the Gcc-help mailing list