objective c - Strcpy in xcode -
this code
char strings[10][10] = {"aaa", "bbb", "ccc"}; strcpy(strings[0], strings[0]); i create c project in xcode, , run crash. if objective-c project, no problem
calling strcpy when source , destination overlapping (or identical in case) undefined behaviour in c, c++, objective-c , objective-c++. undefined behaviour means "anything can happen". "anything" includes crashing 1 compiler , not crashing compiler. includes worse things.
Comments
Post a Comment