hi, i have the following code... im just wondering if what i did was a good way to get the outcome.
Code:/* lets assume userinput = "hello" */
char address[1000] = {0, '/'};
strcat(address, userinput); /* address is now /hello */
Printable View
hi, i have the following code... im just wondering if what i did was a good way to get the outcome.
Code:/* lets assume userinput = "hello" */
char address[1000] = {0, '/'};
strcat(address, userinput); /* address is now /hello */
address will be "Hello", since the '/' is after a 0, so the address variable is essentialy the same as "" (empty string).
--
Mats
icic so when it detects the 0, it interprets it as end of string.
Correct. To initialize the address array, you can code
They are all the same. The backslash is called an escape character.Code:char address[1000] = {'\0'};
or
char address[1000] = '\0' ;
or
char address[1000] = 0 ;
thanks