Is there any particular issue between typedef and pointers?
the code below crashes:
while the code below works fine:Code:#include <iostream> using namespace std; typedef unsigned short int uShort; int main() { uShort a = 45; uShort * ipa = new uShort; ipa = &a; *ipa = 100; uShort newData = *ipa; cout<<newData <<endl; delete ipa; ipa = 0; }
Code:#include <iostream> using namespace std; int main() { int a = 45; int * ipa = new int; ipa = &a; *ipa = 100; int newData = *ipa; cout<<newData <<endl; delete ipa; ipa = 0; }




Reply With Quote