how and where to use templates.. wat is size_t.. pls clearly with one small example ?? ??
pls abt templates
Collapse
X
-
Tags: None
-
Use templates where you have a function or class that can be genralised for types
i.e.
Code:template<class T> T max(T a, T b) { if (a > b) return a; return b; }
size_t is just an unsigned integer type that represents the size of something. It is returned by standard library functions like strlen and used as an input parameter in standadrd library functions like memcpy. -
-
Originally posted by Banfause size_t for any variable that represents the size of some other variable.Comment
Comment