Home C-tutorials C Array of String



C Array of String
Posted on: February 5, 2009 at 12:00 AM
A String is an array of char objects. An array of string can be declared and handled like a 2d(two dimensional) arrays.

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 <stdio.h>
#include <conio.h>
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();
}

Output will be displayed as:

ARRAYSTR.EXE

Download Source Code

Related Tags for C Array of String:
cstringarraysarrayobjectioobjects2dcolumncharcolumnsnsischaracterrowlikehandlerowsexamplecteexamwsecanliiminmtrsticajcldeclaremehrobjumnxaxampseecolatrackishaimeivmplraydimensionandaractconsstrtwssriringthavsthatctsdimensionalecllumjepleplndonolo


More Tutorials from this section

Ask Questions?    Discuss: C Array of String   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.