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 the difference between n=1 and n==1 in the C language?
'=' is ASSIGNMENT operator , where as '==' is COMPARISON operator. int a=7; assigns the variable a an integer value 7 , where as a==7; checks if the VALUE of a is EQUAL to 7.
Soujanya
0 0
8
Which book is good for C language?
Let Us C by writer-- Yashavant P. Kanetkar (Author)
Rajendra
What are the main characteristics of c programming?
C programming is characterized by several key features that contribute to its popularity and versatility. Here are some of the main characteristics of the C programming language: Procedural Programming: ...
Balendra
0 0
6
What is "&" called in C language?
In the C programming language, the "&" symbol is called the "address-of" operator. It is used to obtain the memory address of a variable. When you use "&" followed by a variable name, it provides...
Soumya
0 0
5

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

Ask a Question

Related Lessons

Working with C/C++ applications
Inorder to learn C and C++ programming languages one can work with various editors available.To name a few are the most popular one is turbo c++, DEV C++, Eclipse, NetBeans. Here are the screen shots...
S

C PROGRAM FOR GENERATING SOUND
#include<stdio.h> #include<conio.h> #include<dos.h> void main() { sound(3000); // sound function have single parameter , this parameter we put integer value its generating...

V. Muthu Ganeshan

0 0
0

Be prepared to get trained--init
Before starting the training,students must be mentally prepared for acceptance of new knowledge. Students must attend training with open minded forgetting the position they are working.This will help...
S

Smartnub Softsolutions

0 0
0

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

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