My Tech notes: C-Array Of Strings Manipulation Explained Program

Unix Documentation

Free Online Unix Training Materials

Lists many links to free Unix training materials.

Pointers and Arrays Materials

Pointers and Arrays materials Explained for C beginners

C FAQ and General Questions C Interview Questions

Powered By

Free XML Skins for Blogger

Powered by Blogger

Monday, August 18, 2008

C-Array Of Strings Manipulation Explained Program

C-Array Of Strings Manipulation Explained
How to declare array of strings?
1. char stringarray[10][10]

2. char *stringarray[10]

I prefer second one for declaration of array of strings,

How to Manipulate Array of strings?
Copy some values in this array,
char *tmp=NULL;

stringarray[0]= malloc(strlen(tmp)+1);
if(stringarray[0] != NULL)

The value from tmp variable is copied to zeroth element of string array.
check out using printf
printf("string array element=%s",stringarray[0]);

Like this one can Do other manipulation on array of strings.

No comments:

Post a Comment