Mega Code Archive

 
Categories / C / Code Snippets
 

Using sizeof and pointer arithmetic

#include <iostream> #include <stddef.h> using namespace std; int main( ) { float fvalues[] = {13.23,16.34,88.88,12.11,33.22}; float *pf; size_t fwidth; pf = &fvalues[0]; fwidth = sizeof(float); pf = pf + fwidth; }