11.07.2015 Views

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Supported Data Types and VariablesC Language FeaturesTable 3.3: Radix formatsRadix Format Examplebinary 0bnumber or 0Bnumber 0b10011010octal 0number 0763decimal number 129hexadecimal 0xnumber or 0Xnumber 0x2Fare case insensitive, as are the letters used to specify the hexadecimal digits.Any integral constant will have a type which is the smallest type that can hold the value withoutoverflow. The suffix l or L may be used with the constant to indicate that it must be assigned eithera signed long or unsigned long type, and the suffix u or U may be used with the constant toindicate that it must be assigned an unsigned type, and both l or L and u or U may be used to indicateunsigned long int type.Floating-point constants have double type unless suffixed by f or F, in which case it is a floatconstant. The suffixes l or L specify a long double type which is considered an identical type todouble by HI-TECH C.Character constants are enclosed by single quote characters ’, for example ’a’. A characterconstant has char type. Multi-byte character constants are not supported.String constants or string literals are enclosed by double quote characters ", for example "helloworld". The type of string constants is const char * and the strings are stored in the programmemory. Assigning a string constant to a non-const char pointer will generate a warning from thecompiler. For example:char * cp= "one";const char * ccp= "two";// "one" in ROM, produces warning// "two" in ROM, correctDefining and initializing a non-const array (i.e. not a pointer definition) with a string, for example:char ca[]= "two";// "two" different to the aboveproduces an array in data space which is initialised at startup with the string "two" (copied fromprogram space), whereas a constant string used in other contexts represents an unnamed constqualifiedarray, accessed directly in program space.HI-TECH C will use the same storage location and label for strings that have identical charactersequences, except where the strings are used to initialise an array residing in the data space as shownin the last statement in the previous example.Two adjacent string constants (i.e. two strings separated only by white space) are concatenatedby the compiler. Thus:30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!