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

What is meant by high-order and low-order bytes?
Lower order and higher-order bytes are the terms used while computing calculations in a programming language. Usually, numbers are written from left to right. The left is the most significant bit, and...
Vishal
0 0
9
What is the best website to learn c language?
First go through the book "Let Us C" by Yashawant Kanetkar, then try to implement few small codes by your own, it takes time but you will learn it properly by experience only
Nom
Other than in a for statement, when is the comma operator used?
Example : int i,j; i=(10,20,30,40); j=10,20,30,40; printf("%d",i); printf("%d",j); // in this program output of i will be 40 and j will be 10 // In interviews you can face such type of comma operator related questions.
Sanjay

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

Ask a Question

Related Lessons

Efficient Learning Strategies
Type your notes after class Write your notes onto flashcards - Scrabble -Make posters Review flashcards while walking, at gym, etc. Dog-ear pages in the reading where you can find...

C++ Program-Working with constant using #define preprocessor
//Header Files #include#include // using #define preprocessor for defining a constant#define len 10#define br 5#define rad 3#define NEWLINE '\n' //Main function void main(){ int area_r; float area_c; //Function...

Why C is a Language and not a database?
When I interviewed a candidate, I raised this question many times, but I have not got the answer correctly. To under why C is a language and not a database, it is good to understand why our communication...

Tress And Its Traversal
Depth First Traversals:(a) Inorder (Left, Root, Right) : 4 2 5 1 3(b) Preorder (Root, Left, Right) : 1 2 4 5 3(c) Postorder (Left, Right, Root) : 4 5 2 3 1 Trees are one of the data structures like...

Programing Languages Learning Tricks
You want to learn that new language or library or framework as soon as possible, right? That’s understandable. Fortunately, there are a handful of tips that can help you to better retain all of that...

Harshal G.

0 0
0

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