Skip to content

Instantly share code, notes, and snippets.

@Codeplaza
Created November 5, 2013 08:24
Show Gist options
  • Save Codeplaza/7315612 to your computer and use it in GitHub Desktop.
Save Codeplaza/7315612 to your computer and use it in GitHub Desktop.
// increaser
#include <iostream>
using namespace std;
void increase (void* data, int psize)
{
if ( psize == sizeof(char) )
{ char* pchar; pchar=(char*)data; ++(*pchar); }
else if (psize == sizeof(int) )
{ int* pint; pint=(int*)data; ++(*pint); }
}
int main ()
{
char a = 'x';
int b = 1602;
increase (&a,sizeof(a));
increase (&b,sizeof(b));
cout << a << ", " << b << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment