But this works, where I have both the variable name and function name used:

#include<stdio.h>int charu(int x);int charu(int x)
        {
        return x;
        }
main(){*
        int a = charu(45);
        int charu = a;*
        int scanf=78;
        //int printf=45;
        int getchar=6;
        printf("%d",charu);
        //error if this line is uncommented charu=charu(6);
        printf("\n%d",getchar);
        puts("Wow it ran");
 }


http://ideone.com/xN2yi



Local variable names trump function names. You can call the function as long
as compilers doesn't come across a local variable of same name.
Once it does that, call to the function will give compiler error.
(This is not an authoritative answer. This is from what I observe them
behaving as)

-- 


On Tue, Jul 12, 2011 at 1:14 PM, saurabh singh <[email protected]> wrote:

> For 1st problem learn the concepts of linking.Scanf hasn't been required to
> link yet in the main.
> So during compling the program doesn't give any special treatment to scanf.
> check this,
> #include<stdio.h>
> int charu(int x);
> int charu(int x)
> {
> return x;
> }
> main()
> {
> int charu=67;
> int scanf=78;
> //int printf=45;
>  int getchar=6;
> printf("%d",charu);
> //error if this line is uncommented charu=charu(6);
>  printf("\n%d",getchar);
> puts("Wow it ran");
> }
>
> On Tue, Jul 12, 2011 at 1:03 PM, Abhi <[email protected]> wrote:
>
>> PROBLEM 2:  First all the expressions are evauated from right to left in
>> printf() and then results printed with tha final value of i.
>>
>>  --
>> 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/-/9uxWDI2wuhwJ.
>>
>> 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.
>>
>
>
>
> --
> 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 [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.

Reply via email to