As you can see from the above reference, the same question can be answered differently for different languages.
In general, most modern programming languages do not permit the same name applied to different types because it would be confusing for the compiler.
There could be exceptions where scalars and arrays have different name spaces (e.g. Perl). Even then, the arrays have a prefix (@). So @name and name are different variables.
can we create two variables of same name and of different datatype?
1 answer