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

Are C Programmers currently in demand?
Ofcourse, C is alwasy in demand. In the beginning a lot of the big project developed in C language. Now a days, there are a lot of language in market and speciallity is growing in IT field. For a big organization...
Harsha
What is meant by “enum” in C?
An enum is a keyword in C language, it is an user defined data type. All properties of integer are applied on Enumeration data type It work like the Integer.
Geetanjali
Why is the C program giving the wrong output?
Hi Chandra, Please remember that the program will not give wrong output. The output might be wrong only in the case where there has been incorrect logic used or different output is expected. What is the...
Chandra
0 0
5
How do I learn C programming effectively? What is the best book?
C: The Complete Reference is written by Herbert Schildt is one of the best book for beginners
Sk
0 0
7
how to calculate address of n dimensional matrix
An n dimensional matrix can be of any dimension. Adding a dimension is adding one more index number (to access the element). In 1-D array you the elements are linearly arranged and can be addressed as...
Rupendra

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

Ask a Question

Related Lessons

How do i get best Campus / Off Campus Placement?
Companies are looking for Skilled Freshers. So build your technical skills while doing MCA / BTech / BCA / BSc (IT or CS) into below areas- 1. Strong your programming & debugging skills ...

Swapping variable contents using C
/* WAP to swap the content of variables using C*/ //Header files #include<stdio.h>#include<conio.h> //Main function void main(){ //Variable declaration of type integer int a,b,c; //function...

Memory Layout of C Programs
A typical memory representation of C program consists of following sections. Text Segment: A text segment, also known as a code segment or simply as text, is one of the sections of a program in an object...

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...

PRACTISE makes you PERFECT ; ; ; There is no SUBSTITUTE for HARD WORK ;;;;Breathe SUCCESS like OXYGEN
Proper Planning ( reg what portions to be covered today) revising today's class portions & clarifying doubts solving Maths problems regularly ,noting down formulae separately trying to understand...

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