A String is an array of char objects. An array of string can be declared and handled like a 2d(two dimensional) arrays.
A String is an array of
Here is the code:
ARRAYSTR.C
C Array of String
In this section you will learn how to create an array of string in C.A String is an array of
char
objects. An array of string can be declared and handled like a 2d(two
dimensional) arrays. You can see
in the given example that we have declare a 2 dimensional character array
consisting of three 'rows' and twelve 'columns'. The array is initialized with
three character strings. In C, a format specifier %s is used with the printf to
print the string.Here is the code:
ARRAYSTR.C
#include
#include
void main() {
clrscr();
char arr[3][12]= { "Rose", "India", "technologies" };
printf("Array of String is = %s,%s,%s\n", arr[0], arr[1], arr[2]);
getch();
}
No comments:
Post a Comment
Thank you