UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

I would like to know how we can use two dimensional arrays in strings? I would also know whether we can compare two dimensional strings?

Asked by Last Modified  

Follow 0
Answer

Please enter your answer

MS SQL SERVER DBA Trainer

// Two-dimensional array. int array2D = new int { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; // The same array with dimensions specified. int array2Da = new int { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; // A similar array with string elements. string array2Db = new string { { "one", "two" },...
read more
// Two-dimensional array. int[,] array2D = new int[,] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; // The same array with dimensions specified. int[,] array2Da = new int[4, 2] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; // A similar array with string elements. string[,] array2Db = new string[3, 2] { { "one", "two" }, { "three", "four" }, { "five", "six" } }; read less
Comments

MS SQL SERVER DBA Trainer

We can compare two dimensional strings? like String matching is a special kind of pattern recognition problem, which finds all occurrences of a given pattern string in a given text string. The technology of two-dimensional string matching is applied broadly in many information processing domains....
read more
We can compare two dimensional strings? like String matching is a special kind of pattern recognition problem, which finds all occurrences of a given pattern string in a given text string. The technology of two-dimensional string matching is applied broadly in many information processing domains. A good two-dimensional string matching algorithm can effectively enhance the searching speed. read less
Comments

IT Teacher

Yes can compare but we need to compare element by element.
Comments

https://www.linkedin.com/in/dr-jitendra-v-tembhurne-40777a17/

char string;
Comments

Computer tutor

Variablename; for eg a during declaration arrays should be null and durind calling pass the size of array.
Comments

B.E (Computer Science & Engineering) 78%; MS (Computer Science) (USA) (GPA: 3.8/4.0)

You can declare a two dimensional array of characters as: char str_array; The above declaration means str_array is an array of two strings where each string can have a maximum of 5 characters. for example: str_array = "one"; // first string with 3 characters length str_array = "two"; // second...
read more
You can declare a two dimensional array of characters as: char str_array[2][5]; The above declaration means str_array is an array of two strings where each string can have a maximum of 5 characters. for example: str_array[0] = "one"; // first string with 3 characters length str_array[1] = "two"; // second string with 3 characters length. Yes you can compare two dimensional strings with the condition that you are comparing one string /element at a time. read less
Comments

IT Professional Trainer With 12 Year of Experience

String is a one dimensional character type array char name = " Ashutosh Kumar "; space A s h u t o s h K u m a r space \00 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 name = A name= space Two Dimensional array used in ragged array char *name; for(i=0;i<5;i++)...
read more
String is a one dimensional character type array char name[] = " Ashutosh Kumar "; space A s h u t o s h K u m a r space \00 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 name[0] = A name[14]= space Two Dimensional array used in ragged array char *name[5]; for(i=0;i<5;i++) { printf("Enter the no of char :"\n); scanf("%d",&n); names[i]=(char*) malloc(n*sizeof(char)); printf("\n Enter a name which you want to register :\n"); scanf("%[^\n]",names[i]; } name[0] = "Delhi" name[1] = "Bangalore" name[2] = "Mumbai" name[3] = "Patna" name[4] = "Gaya" read less
Comments

IT Professional Trainer With 12 Year of Experience

Two way to compare the string Method 1: include"string.h" strcmp(string1 , string1); Method 2: for(i=0;i<5;i++) { for(k=0;k read more
Two way to compare the string Method 1: include"string.h" strcmp(string1 , string1); Method 2: for(i=0;i<5;i++) { for(k=0;kread less
Comments

Even two dimensional array is stored in consecutive locations. We should do compare opn.
Comments

Computer Programming Expert and Software Developer

if somebody wants to store more than one strings such as student names, city names, address lines etc., he/she can use two dimensional array for storing strings. To declare two dimensional array, we can have the following syntax : char arryname . Here 10 is the number of strings we can store and 100...
read more
if somebody wants to store more than one strings such as student names, city names, address lines etc., he/she can use two dimensional array for storing strings. To declare two dimensional array, we can have the following syntax : char arryname[10][100] . Here 10 is the number of strings we can store and 100 is the maximum length of each string. For taking input to array we can use the for loop in following way: for (i=0;i<10;i++){ scanf("%s",arryname[i]); Similarly, for compare two dimensional strings , we can use built-in function strcmp() or we can go for character by character comparison using loop. read less
Comments

View 36 more Answers

Related Questions

In which program we use character constants?
For the name of months, animal, colors we do use it.
Mona
What is the meaning of \n and \t in C language?
is used for new line and \t is used to give 3-space (1 tab space) in between the words
Soumya
0 0
5
Does a civil engineer need to learn the C language?
C language is a common subject in the first year of engineering irrespective of the branch. It may not be helpful for your civil engineering career but you definitely need to pass for B.Tech graduation.
Sandeep
0 0
5
How do I print \n in C or C++ programming?
void main () { printf(" "); getch(); }
Supriyo
0 0
6

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

10 Tips to improve your learning
1. Have a quick revision of topics that you have read in past three days before you start studying a new topic. 2. Make your own notes containing the summary of the topic. 3. Allot proper timing for...

Find out the Output of the following with reason and get C Language Training fess less by 10%
1. void main() { clrscr(); printf(5+"Beautifull"); getch(); } 2. void main() { int a=50; clrscr(); ...

Features Of C Language
Features of C language It is a robust language with rich set of built-in functions and operators that can be used to write any complex program. The C compiler combines the capabilities of an assembly...

Why Indexing Should Start From Zero In Array ?
Why numbering should start at zero? To denote the subsequence of natural numbers 2, 3, ..., 12 without the pernicious three dots, fourconventions are open to usa) 2 ≤ i < 13b) 1 < i ≤ 12c)...

Array vs Linked List
Array Linked List Accessing element is easy. Accessing element is difficult compare to Array. Easy to use. Difficult to use. Memory is Fixed size. Memory is variable size. If...

Recommended Articles

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Whether it was the Internet Era of 90s or the Big Data Era of today, Information Technology (IT) has given birth to several lucrative career options for many. Though there will not be a “significant" increase in demand for IT professionals in 2014 as compared to 2013, a “steady” demand for IT professionals is rest assured...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more