2013-10-28 7:54 AM
Hi everyone,
I have to handle strings in my code and I don't know how to use this type of data. I assume that it comes with the compiler I'm using (gcc arm-none-eabi). I found and declared 'string.h' at the begining of my code like this : &sharpinclude <string.h> but it seems like it contains only functions to manipulate strings, and not the type itself. I'm stuck because for now, all I can do is declare strings by initializing a char tab. Thanks for any help. #type #char #string2013-10-28 8:15 AM
I'm stuck because for now, all I can do is declare strings by initializing a char tab.
Strings in C are NUL terminated arrays of characters. C++ might provide a type, C does not. You have to manage strings with in C, handling the space allocated for them, and how they might expand, etc. They are not abstracted like they are with many other languages. A quick shot-gun search with Google turned up these, plenty of others too
http://www.cs.swarthmore.edu/~newhall/unixhelp/C_strings.html
http://www.eskimo.com/~scs/cclass/notes/sx8.html
http://www.tutorialspoint.com/cprogramming/c_strings.htm
http://computer.howstuffworks.com/c35.htm
2013-10-28 8:52 AM
Thanks Clive, saved me once again.