i have a doubt how can we use string in matrices for examples a[0][0]=rohinn a[0][1]=rithish how to do this????
rithish
13
Junior Poster in Training
Recommended Answers
Jump to Poststart with something like this:
char array[3][20]= { "one", "two", "three" }; printf("%s, %s, %s\n", array[0], array[1], array[2]);
for user input you can use a loop for every index
Jump to PostIf a[0][0] and a[0][1] are both null-terminated strings, then you have to call strcmp() to check of the two strings are the same. The following will produce a two-dimensional array of strings that contain up to 40 characters each.
char a[2][2][40]; strcpy(a[0][0],"Hello"); strcpy(a[0][1],"World"); if( strcmp(a[0][0], a[0][1]) == …
All 5 Replies
zeroliken
79
Nearly a Posting Virtuoso
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
rithish
13
Junior Poster in Training
zeroliken
79
Nearly a Posting Virtuoso
zeroliken
79
Nearly a Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.