mercredi 26 août 2020

Returning different data types from a function in c++

I am writing some kind of buffer parser that takes vector of unsigned char bytes as an input,for example

Datatype getvalue(vector<unsigned char> buffer) 
{
  // compute value
  If vector contains 2 bytes then unsigned int will be returned
  If vector contains 4 bytes then unsigned long will be returned 
  If 12 bytes then date time will
 be returns 
  return value;
}

Aucun commentaire:

Enregistrer un commentaire