i think this must have produced a warning......conversion from const char *
to char*.......

On Tue, Aug 16, 2011 at 8:52 PM, Sanjay Rajpal <sanjay.raj...@live.in>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 <raman.u...@gmail.com> 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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 

      Regards
Himanshu Kansal
  Msc Comp. sc.
(University of Delhi)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to