Hi
This type of function overloading works in c .
Execute following code and it will call function fun as per the
function parameter

code snip-in
---------------------
#include<stdio.h>
void fun(const char *p)
{
        printf("funsfsdafsf1\n");
}
void fun(char *P)
{
        printf("fun2\n");
}
void main()
{
        char str[] = "funcheck";
        const char str1[] = "constcheck";
        fun(str);
        fun(str1);
}
---------------------

output
------------
fun2
funsfsdafsf1
----------------

Mayur


On Nov 21, 6:30 pm, Anil Arya <anilarya...@gmail.com> wrote:
> dude....compile using g++
>
> On 11/21/11, atul anand <atul.87fri...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > this is what i am getting after executing code meintion in the above link.
>
> > (using gcc compiler )
>
> > temp.c:12: error: conflicting types for 'fun'
> > temp.c:7: error: previous definition of 'fun' was here
>
> > On Mon, Nov 21, 2011 at 3:09 PM, UTKARSH SRIVASTAV
> > <usrivastav...@gmail.com>wrote:
>
> >>http://www.ideone.com/JQFNh
> >> CHECK THE OUTPUT THERE IS NO AMBIGUITY BUT PLEASE EXPLAIN THE RESULTS
>
> >> On Sun, Nov 20, 2011 at 11:00 PM, Akash Coder
> >> <akash.coder.g...@gmail.com>wrote:
>
> >>> it wont work
>
> >>> even this wont
>
> >>> function(char a[])
> >>> function (char *)
> >>> coz the two forms are interchangeable
>
> >>> On Sun, Nov 20, 2011 at 10:12 PM, saurabh singh
> >>> <saurab...@gmail.com>wrote:
>
> >>>> wont work......Thre is no way compilers gonna guess which function to
> >>>> call.The const qualifier only guarantees that the value at the address
> >>>> wont
> >>>> be altered inside the function.That has nothing to do with calling,
>
> >>>> On Sun, Nov 20, 2011 at 9:50 PM, rahul vatsa
> >>>> <vatsa.ra...@gmail.com>wrote:
>
> >>>>> yes, it will work.
>
> >>>>> On Sun, Nov 20, 2011 at 9:12 PM, Akash Coder <
> >>>>> akash.coder.g...@gmail.com> wrote:
>
> >>>>>> no it wont work ... const is not a datatype. its  a qualifier
>
> >>>>>> On Sun, Nov 20, 2011 at 7:49 PM, rahul sharma <rahul23111...@gmail.com
> >>>>>> > wrote:
>
> >>>>>>> void fun(char *)
> >>>>>>> void fun(const char *)
>
> >>>>>>> is this overloading works or these are same type of arguments??????
>
> >>>>>>> --
> >>>>>>> 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.
>
> >>>>>> --
> >>>>>> 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.
>
> >>>>>  --
> >>>>> 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.
>
> >>>> --
> >>>> Saurabh Singh
> >>>> B.Tech (Computer Science)
> >>>> MNNIT ALLAHABAD
>
> >>>>  --
> >>>> 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.
>
> >>>  --
> >>> 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.
>
> >> --
> >> *UTKARSH SRIVASTAV
> >> CSE-3
> >> B-Tech 3rd Year
> >> @MNNIT ALLAHABAD*
>
> >>  --
> >> 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.
>
> > --
> > 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.
>
> --
> *Anil  Arya,
> Computer Science *
> *Motilal Nehru National Institute of Technology,Allahabad .
> *

-- 
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