The variable 'ar' is being used without being initialized
int _tmain(int argc, _TCHAR* argv[])
{
char* ar;
*ar = 'a';
printf ("%c\n", *ar);
return 0;
}
fix 1,
int _tmain(int argc, _TCHAR* argv[])
{
char* ar;
char p;
ar = &p;
*ar = 'a';
printf ("%c\n", *ar);
return 0;
}
Output:
a
fix 2,
int _tmain(int argc, _TCHAR* argv[])
{
char* ar;
ar = new char [8];
*ar = 'a';
printf ("%c\n", *ar);
return 0;
}
Output:
a
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment