On 16/05/10 11:31, James Bensley wrote:
Hi Ian,
Thanks for the info. My problem which is probably obvious is that I am coming from other languages and so trying to teach my self by trying different things such as == with what I thought were two strings is all just trial and error but now I understand my mistakes....Oh, the pains of learning a new language :S
C was the first high level language a really learnt (ignoring the smattering of Fortran I needed once for a project in the 70s). The thing to remember about C is that, compared to many other languages, it is a relatively low level one, not least because it was designed to write an operating system. So ALL variables are just numbers of one kind or another and strings are simply a number that is a pointer to the memory where a string is stored.
In many ways the power (and dangers) of C lie in its simplicity. At one extreme you can create complex structures and simply refer to the whole by a number (a pointer). At the other extreme you can easily manipulate bits in a variable.
It is for this reason that the libraries exist, to provide the sort of functions that are naturally a part of other high level languages.
As an engineer I like C because it is a powerful tool that still lets me see under the hood.
Cheers
Ian