4

address of char array

view full story
linux-howto

http://www.linuxquestions.org – I have a question of char array argument passing. See the following code which compile and execute successfully as expected. Code: #include "stdafx.h" #include <stdio.h> #include <string.h> int _tmain(int argc, _TCHAR* argv[]) {   char str1[]="Sampe string";   char str2[40];   char str3[40];     //first method of argument passing   memcpy (&str2,&str1,strlen(str1)+1);   memcpy (&str3,"copy successful",16);   printf ("str1: %s\nstr2: %s\nstr3: %s\n",str1,str2,str3);   //second me (HowTos)