tags:

views:

55

answers:

3

suppose there is a string of characters in an array of d[20] . How to convert to a string d so that i can use it in string functions like strcmp..

+3  A: 

It must be null-terminated. That's the only requirement. I presume you know how to do that.

Alex
yup .. i do know how to do it
mekasperasky
+2  A: 

Null terminate the string. That is, set the character after the last character in your string to zero.

+1  A: 

it's already something on which you can operate with standard string functions, assuming that it ends with '\0' since it's a requirement: it needs to know when the string ends.

You can prepare the space of char[] by memsetting it with memset(string, 0, length).

Jack