Toggle the parent tree of C Programming Structures Containing Arrays, Pointers, and Strings. Learn Software and Hardware Tools Toggle the hierarchy tree under Learn Software and Hardware Tools. Fundamentals of the C Programming Language Toggle the hierarchy tree under Fundamentals of the C Programming Language. C Programming Structures Containing Arrays, Pointers, and Strings Toggle the hierarchy tree under C Programming Structures Containing Arrays, Pointers, and Strings.
Strings:
May be assigned directly to char array member only at the declaration.
May be assigned directly to a pointer to a char member at any time. Example: Structure 1 struct strings2 {3 char a[4 ]; 4 char * b; 5 } str;
Example: Initializing Members 1 int main (void )2 {3 str.a[0 ] = 'B' ;4 str.a[1 ] = 'a' ;5 str.a[2 ] = 'd' ;6 str.a[3 ] = '\0' ;7 8 str.b = "Good" ;
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.