G
George2
Hello everyone,
Suppose we defined a string buffer (array), like this,
char array[] = "hello world";
char buf[256]
Sometimes, I noticed that we either use,
1. array (buf)
or use,
2. &array (&buf)
or use
3. &array[0] (&buf[0])
as the beginning address of the array,
example like,
strcpy (buf, array);
strcpy (&buf, array);
....
I am wondering the differences between the 3 approaches, and which
approach is the most correct?
thanks in advance,
George
Suppose we defined a string buffer (array), like this,
char array[] = "hello world";
char buf[256]
Sometimes, I noticed that we either use,
1. array (buf)
or use,
2. &array (&buf)
or use
3. &array[0] (&buf[0])
as the beginning address of the array,
example like,
strcpy (buf, array);
strcpy (&buf, array);
....
I am wondering the differences between the 3 approaches, and which
approach is the most correct?
thanks in advance,
George