On Thu, 16 Jan 2003, Dorin Lazar wrote: > > Vrei sa afli numarul de elemente al unui array (tratandu-l ca pe un > > pointer), nu? > > int *p = (int*)malloc(100*sizeof(int)); > > nr_elem = (sizeof p / sizeof *p); // imparti marimea totala la > Adica 1? > sizeof (p) nu e sizeof(int *)? > sizeof *p nu e sizeof (int)? > cel mai des sizeof (int *) == sizeof(int) ^^^^^^^^^^^^
cel mai des asta inseamna numai 32bit, ori sunt destule arhitecturi 64bit si omul preciza pe undeva cuvantul "portabil" (whatever that means) :) ---------------------------- Mihai RUSU Disclaimer: Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of any company, unless otherwise specifically stated. --- Pentru dezabonare, trimiteti mail la [EMAIL PROTECTED] cu subiectul 'unsubscribe rlug'. REGULI, arhive si alte informatii: http://www.lug.ro/mlist/
