struct & global variable

Andi Hellmund mail@andihellmund.com
Sat Sep 26 10:46:00 GMT 2009


Hey,

what Andrew meant is that we can't help you until we see at least the
complete code for filling_node() and func2().

The best would be if you paste your code and clearly describe where you
expect an output, but finally don't see one ...

Andi

Mohsen Pahlevanzadeh wrote:
> My printf that doesn't print anything is called in func2 that i don't
> remember i wrote in previous email.
> Quoting Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org>:
>
>> 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.....
>> -------------------------------------
>> System Administrator
>
>
>
> -------------------------------------
> System Administrator
>
>
>



More information about the Gcc-help mailing list