On line 16, shouldn't it be strcpy(*name, "John") because I thought name (without the dereferencing operator) can only store an address and not a c-string, or any other data for that matter.
Ok cool. I am using Visual C++ 2008 Express Edition. I didn't realize I didn't include that header but somehow the compiling still succeeded... although there was a problem with strcpy that I am not sure about:
------ Build started: Project: Project, Configuration: Debug Win32 ------
Compiling...
Source1.cpp
c:\users\kevin\documents\visual studio 2008\projects\project\project\source1.cpp(16) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'
Linking...
Embedding manifest...
Build log was saved at "file://c:\Users\Kevin\Documents\Visual Studio 2008\Projects\Project\Project\Debug\BuildLog.htm"
Project - 0 error(s), 1 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
That's just Microsoft deprecating a few slightly unsafe features and offering their own to replace them.
You need to make sure on your own (I think) that the destination points to at least enough memory to hold all of the string pointed to by source. Otherwise, you'll have some difficulty making the copy. ;)
the microsoft compiler lets you get away with alot. ive noticed you dont have to include limits for many things as well. string seems ok to declare it without the string header but if you try and use it with cout it will fail to compile without using the right header.