Skip to content

Instantly share code, notes, and snippets.

Created March 25, 2015 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3982b0a769cb53bc2297 to your computer and use it in GitHub Desktop.
Save anonymous/3982b0a769cb53bc2297 to your computer and use it in GitHub Desktop.
detectCollision - why do I need to check for object == NULL before strcmp?
GObject object = detectCollision(window, ball);
if (object == paddle)
{
//**this if works fine without checking for object == NULL***
ydisp = -ydisp;
}
if (object == NULL)
{
//***Why do I need to check if object == NULL in order for te next if (strcmp) to work? ***
}
else if
{strcmp(getType(object), "GRect") ==0)
{
if (object != paddle)
{
ydisp = -ydisp;
removeGWindow(window, object);
etc
etc
} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment