Issues Related to Function Decleration

I have encountered some problems while writing the code for 8051 microcontroller, Can you explain me
the following issues:

1- Compiler issued an error when i pass the value to function by referece e.g. void function( unsigned char& val);

2- Comiler issued an error when i tried to use the default argment to a function e.g. unsigned char Volume ( char side = 1 );

3- Comiler also issued error when i tried the function overloading method e.g. void function (unsigned char val); void function (unsigned int val);

4- How can i access variables with the same name which are both declerad local and global?

Can anyone tell me above mentioned issue with keil comiler.

Regards,
Ahmad Kamal Nasir

Parents
  • 1- Compiler issued an error when i pass the value to function by referece

    ANSI C does not support passing by reference

    Comiler issued an error when i tried to use the default argment to a function

    ANSI C does not support default arguments

    Comiler also issued error when i tried the function overloading method

    ANSI C does not support function overloading

    "How can i access variables with the same name which are both declerad local and global"

    You can't - you have to give them different names!

    What would be the point of having different variables with the same name, anyhow, if they need to be simultaneously accessible?!

Reply
  • 1- Compiler issued an error when i pass the value to function by referece

    ANSI C does not support passing by reference

    Comiler issued an error when i tried to use the default argment to a function

    ANSI C does not support default arguments

    Comiler also issued error when i tried the function overloading method

    ANSI C does not support function overloading

    "How can i access variables with the same name which are both declerad local and global"

    You can't - you have to give them different names!

    What would be the point of having different variables with the same name, anyhow, if they need to be simultaneously accessible?!

Children
More questions in this forum