ionut.hulub Posted February 12, 2012 Report Share 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 Link to comment Share on other sites More sharing options...
alien Posted February 12, 2012 Report Share Posted February 12, 2012 sizeof(int)=4, sizeof(char*)=4, sizeof(void*)=4, sizeof(char)=121/4 = 5 Quote Link to comment Share on other sites More sharing options...
ionut.hulub Posted February 12, 2012 Author Report Share Posted February 12, 2012 Raspuns corect!Challange closed Quote Link to comment Share on other sites More sharing options...
Nytro Posted February 12, 2012 Report Share 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 Link to comment Share on other sites More sharing options...
alien Posted February 12, 2012 Report Share Posted February 12, 2012 Are dreptate Nytro, pe 64bit un pointer e dublu fata de int si parca si long... Quote Link to comment Share on other sites More sharing options...
cmiN Posted February 13, 2012 Report Share 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 Link to comment Share on other sites More sharing options...
backdoor Posted February 13, 2012 Report Share Posted February 13, 2012 sizeof(int) pe 33 biti cat are ? 12 cm ? Quote Link to comment Share on other sites More sharing options...