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

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -