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  

38 Answers

Learn C Language

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

Can you suggest me some books for learning C?
"letus c" for c programming yashwant kanetkar
Yamun
How do I write a C program to print the total number of a single-digit prime number using a loop?
total number of single digit prime number that means your prime number starts from 2 and less than 9 so you can take loop for this range
Momin
0 0
7
Is a default case necessary in a switch statement?
NO, default is optional and you can omit it if there is no use of it.
My
How do I send a C program via email?
By using Google drive
Furqankhan
0 0
5
What is the difference between a string and an array?
An array is an array of anything. A string is a specific kind of an array with a well-known convention to determine its length. There are two kinds of programming languages: those in which a string is...
Rakes

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

Ask a Question

Recommended Articles

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 >

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 >

Applications engineering is a hot trend in the current IT market.  An applications engineer is responsible for designing and application of technology products relating to various aspects of computing. To accomplish this, he/she has to work collaboratively with the company’s manufacturing, marketing, sales, and customer...

Read full article >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

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