Hi to all list!!! Opsss!!! your topic is all about C compiler. Can I join? If so, I have a PIC C Compiler demo but my problem is that I don't know how to start with because this is the first time I'm going to use C for embedded. Actually, I know to program turbo C/C++ in a PC. In terms of Embedded C there is a different from Turbo C especially in handling standard input/output. With this, Is there anybody can share a sample program of PIC C (for 16F84) with comments so that I can understand more on programming approach of PIC. Best Regards, -=ianc=- ----- Original Message ----- From: William Chops Westfield To: Sent: Friday, October 13, 2000 1:38 PM Subject: Re: [PIC]: C compilers > I started by defining a char array (char string[10]; works ok) and then > tried to assign it a value (string = 'Hello!'; not ok). > > I was only able to initialize my "string" by individualy giving values to > every byte in my array (string[0]='H'; string[1]='e'; and so on). > > Is this a normal behaviour for a PIC C compiler ? Do the Hitec and CCS > compiler support strings ? > > Um, this is pretty much standard behavior for ANY C compiler. C does not > support strings to any reasonable extent - only arrays of characters and > pointers to characters. Now, a lot of the standard C functions understand > pointers to memory containing character strings that happen to be terminated > by a null, but the LANGUAGE doesn't support much. > > So, you can do: > > char *string = "Hello!"; > > Which gives you a pointer to a 7 character string. This is generally > preferred, for constant strings... > > > Or you can have: > > char string[10]; > strncpy(string, "Hello!", sizeof(string)); > > Which is closer to exactly what you tried to write, but results in your > program ending up using twice the storage (one copy to hold the constant > string "Hello!", and one variable that you put it in. > > BillW > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu