@Rahul : I have also mentioned that for the linker error. You can place a definition int var; after main(), it will work. Sanju :)
On Wed, Aug 31, 2011 at 11:14 AM, rahul vatsa <[email protected]> wrote: > @sanju, if u declare a variable with extern, at compile time its defn is > nt looked for, rather @ link time corresponding defn is looked for by the > linker. nd if the defn is nt ther, it will raise a linker error, as in case > of this prog > > @rahul, ya off course, for a variable to be global it hs to be defined at > file scope. > > > > > On Wed, Aug 31, 2011 at 11:29 AM, Sanjay Rajpal <[email protected]> wrote: > >> Linker error, failed to find symbol 'var'. >> >> >> Sanju >> :) >> >> >> >> On Wed, Aug 31, 2011 at 8:25 AM, rahul sharma <[email protected]>wrote: >> >>> but it is defined inside main????u mean to say for varibale to be gloabal >>> it must be defines outsyd all fxns?? >>> >>> >>> On Wed, Aug 31, 2011 at 8:35 PM, Ashima . <[email protected]> wrote: >>> >>>> u hv just declared the variable and not defined it.So no memory is >>>> allocated to var. so u l get the undefined reference error. >>>> either remove extern or define new local variable int var =10; >>>> Ashima >>>> M.Sc.(Tech)Information Systems >>>> 4th year >>>> BITS Pilani >>>> Rajasthan >>>> >>>> >>>> >>>> >>>> On Wed, Aug 31, 2011 at 7:56 AM, Rajesh Kumar >>>> <[email protected]>wrote: >>>> >>>>> What we do to remove error?? >>>>> #include<stdio.h> >>>>> extern int var; >>>>> main() >>>>> { >>>>> var=10; >>>>> return 0; >>>>> } >>>>> >>>>> Regards >>>>> Rajesh Kumar >>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Algorithm Geeks" group. >>>>> To post to this group, send email to [email protected]. >>>>> To unsubscribe from this group, send email to >>>>> [email protected]. >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
