No the warning in gcc is ibm1.c: In function ‘main’: ibm1.c:7:19: warning: initialization discards qualifiers from pointer target type
On Wed, Aug 17, 2011 at 11:50 AM, venkat <[email protected]> wrote: > yes u r correct > > On Aug 16, 8:22 pm, Sanjay Rajpal <[email protected]> wrote: > > This is becuase "Hello" is a constant string and constant strings get > stored > > in *Data Area, not in stack for the function you called. *Thats why > pointer > > to constant string will be returned and program will not produce any > error. > > > > Sanjay Kumar > > B.Tech Final Year > > Department of Computer Engineering > > National Institute of Technology Kurukshetra > > Kurukshetra - 136119 > > Haryana, India > > > > On Tue, Aug 16, 2011 at 8:19 AM, rohit <[email protected]> wrote: > > > #include<stdio.h>const char *fun(); > > > int main() > > > { > > > char *ptr = fun(); > > > return 0; > > > }const char *fun() > > > { > > > return "Hello"; > > > } > > > > > Why doesn't this code give error?? > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Algorithm Geeks" group. > > > To view this discussion on the web visit > > >https://groups.google.com/d/msg/algogeeks/-/qeUTNwGNKfwJ. > > > 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. > > -- Regards Rajeev N B <http://www.opensourcemania.co.cc> "*Winners Don't do Different things , they do things Differently"* -- 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.
