Thread: sizeof question
View Single Post
Old May 4th, 2008, 12:26 AM   #1
JD-Salinger
Unknown
 
JD-Salinger's Avatar
 
Join Date: Apr 2008
Location: unknown
Posts: 87
Rep Power: 1 JD-Salinger is on a distinguished road
sizeof question

in line 26
assert(maxIdFun==sizeof FunctionArray/sizeof FunctionArray[0])
what is the size of functionArray and size of functionArray[0] i cant understand that... and how come it would equal to maxIdFun... and the point of dividing it
c++ Syntax (Toggle Plain Text)
  1.  
  2. const int maxIdFun=14;
  3.  
  4. FunctionEntry FunctionArray [] =
  5. {
  6. log, "log",
  7. log10,"log10",
  8. exp, "exp",
  9. sqrt, "sqrt",
  10. sin, "sin",
  11. cos, "cos",
  12. tan, "tan",
  13. CoTan,"cotan",
  14. sinh, "sinh",
  15. cosh, "cosh",
  16. tanh, "tanh",
  17. asin, "asin",
  18. acos, "acos",
  19. atan, "atan",
  20. };
  21.  
  22. FunctionTable::FunctionTable(SymbolTable& symTab,FunctionEntry* funArr)
  23. :_size(0)
  24. {
  25.  
  26. assert(maxIdFun==sizeof FunctionArray/sizeof FunctionArray[0])
  27.  
  28. for(int i=0; i<maxIdFun; ++i)
  29. {
  30. int len=strlen(funArr[i].strFun);
  31. if(len==0)
  32. break;
  33. _pFun[i]=funArr[i].pFun;
  34. cout<< funArr[i].strFun<<endl;
  35. int j=symTab.ForceAdd(funArr[i].strFun,len);
  36. assert(i==j);
  37. ++_size;
  38. }
  39. }

thanks a lot
__________________
-------------------------------------------------------------------------
I thought what I'd Do was, I'd pretend to be one of those deaf mutes
------------------------------------------------------------------------
JD-Salinger is offline   Reply With Quote