ionut.hulub Posted February 12, 2012 Report Posted February 12, 2012 Se da codul:int i = sizeof(int) + sizeof(char*) * sizeof(void*) + sizeof(char);printf("%d", i/4);Da sau nu eroare? Daca da, ce eroare? Daca nu, ce afiseaza? Quote
alien Posted February 12, 2012 Report Posted February 12, 2012 sizeof(int)=4, sizeof(char*)=4, sizeof(void*)=4, sizeof(char)=121/4 = 5 Quote
ionut.hulub Posted February 12, 2012 Author Report Posted February 12, 2012 Raspuns corect!Challange closed Quote
Nytro Posted February 12, 2012 Report Posted February 12, 2012 sizeof(char *) si sizeof(void *) depind de arhitectura procesorului, 32 de biti sau 64 de biti.sizeof(int) este cel mai des 4, dar standardul C specifica doar dimensiunea pentru char/signed char/unsigned char ca fiind 1, deci depinde de compilator. Quote
alien Posted February 12, 2012 Report Posted February 12, 2012 Are dreptate Nytro, pe 64bit un pointer e dublu fata de int si parca si long... Quote
cmiN Posted February 13, 2012 Report Posted February 13, 2012 ^ Pe 64 bit doar pointerul e dublu, de aia 32 bit nu-ti vede mai mult de 3-4 gb de ram, dar din nou depinde de compilator. Quote
backdoor Posted February 13, 2012 Report Posted February 13, 2012 sizeof(int) pe 33 biti cat are ? 12 cm ? Quote