mercredi 18 mars 2015

Variable and constant with same name


I have a C code snippet as follows:



const int x = 5;
void main()
{
int x[x];
int y = sizeof(x) / sizeof(int);
printf("%d",y);
}


The code snippet would be compiled and run correctly. But I don't understand how to differentiate x 'variable' and x 'const'.




Aucun commentaire:

Enregistrer un commentaire