samedi 27 juin 2015

Is this one-based indexing trick in C safe?

I saw someone doing this to have array index starting at 1 instead of 0 in C.

a = (int *) malloc(sizeof(int)*3) - 1

Is there any risk in this?

Aucun commentaire:

Enregistrer un commentaire