E
Emmanuel Delahaye
Il Prof wrote on 04/08/04 :
It depends on the implementation.
It depends on the implementation.
It depends on the usage.
Pointing to a different string is fast and efficient, but it's not
always possible.
char * p = "hello";
if (language == FRENCH)
{
p = "boujour";
}
Not directly, but a smart usage of strncat() can help a lot.
Probably. http://www.snippets.org/ comes to my mind.
I have some here too:
http://mapage.noos.fr/emdel/clib.htm
Module STR (drop me an email if you are stuck)
Google is your friend.
I'm new in C language (but not in structured programming) and i have
some questions about strings:
1) What of this two string access methods is faster?
- Direct access of the elemtns of an array of char (myarray)
- Access through a pointer to char (*mypointer)
It depends on the implementation.
2) Is more (time) efficient the allocation of strings in the heap or in
the stack?
It depends on the implementation.
3) What is the correct method of assign a new value to a string? Perhaps
the using the strcpy of the new value in the ols string?
It depends on the usage.
Pointing to a different string is fast and efficient, but it's not
always possible.
char * p = "hello";
if (language == FRENCH)
{
p = "boujour";
}
4) Exists a function that return a substring (from a start element to a
finish element) of a string?
Not directly, but a smart usage of strncat() can help a lot.
5) There are some other (non ANSI standard) C libraries that are known
as very useful and often used in practical programming? Some web links
on this?
Probably. http://www.snippets.org/ comes to my mind.
I have some here too:
http://mapage.noos.fr/emdel/clib.htm
Module STR (drop me an email if you are stuck)
Google is your friend.