|
> From: "Pantzopoulos, Mike" <mikepantzopoulos@mynd.com> > To: "'C400-L@midrange.com'" <C400-L@midrange.com> > Subject: > Date: Tue, 20 Jun 2000 21:03:42 -0400 > Reply-to: C400-L@midrange.com > This message is in MIME format. Since your mail reader does not understand > this format, some or all of this message may not be legible. > > ------_=_NextPart_001_01BFDB1C.8FB1408E > Content-Type: text/plain; > charset="iso-8859-1" > > I'm a bit confused about how to deal with a single character. Is a char > x[1]; or char x; statement defining a string or a character? > Ishould it be compared via a ............if(x== '1') statement or should a > strcmp function be invoked? I presume that any definition such as char x[6] > defines a string (as null terminated). So is char x[1] defining a null > terminated string of length 2 (inclusive of the null character)? > Only one thing to add to Patrick's letter : This is all true and char x[1] is a char array with length 1. There is formally no such issue like string in C, simply C-programmers are used to zero-terminated strings. The world of C/400 is a bit different, as when you play with data base files (PF-s) alfanumeric fields are not "C-strings" - zero-terminated, but rather char arrays. Funny is that when you use #pragma mapinc to make compiler automatically generate structures for records of PF-s you are going to use and record contain a CHAR field (1 byte), structure generates a definition of char ZZZ[1] - not a char, but char array of 1 element. So you cannot compare like if (ZZZ == 'N') you must write if (ZZZ[0] == 'N') Regards, Jevgeni Astanovski, IT Hooldusosakonna juhataja Optiva Pank. +--- | This is the C/400 Mailing List! | To submit a new message, send your mail to C400-L@midrange.com. | To subscribe to this list send email to C400-L-SUB@midrange.com. | To unsubscribe from this list send email to C400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: bob@cstoneindy.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.