UrbanPro

Learn C Language from the Best Tutors

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

Search in

What is the difference between a string and an array?

Asked by Last Modified  

Follow 2
Answer

Please enter your answer

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 just an array of characters, and those in which its a special type. In C, a string is just an array...
read more
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 just an array of characters, and those in which its a special type. In C, a string is just an array of characters (type char), with one wrinkle: a C string always ends with a NUL character. The value of an array is the same as the address of (or a pointer to) the first element; so, frequently, a C string and a pointer to char are used to mean the same thing. An array can be any length. If its passed to a function, theres no way the function can tell how long the array is supposed to be, unless some convention is used. The convention for strings is NUL termination; the last character is an ASCII NUL () character. read less
Comments

Professional Tutor with 15 years of experience.

String is array of characters terminated with null.
Comments

Thanks for the question Rakes, String is just a character array which can hold only character type data whereas array is a collection of similar types of element and the type can be any data type. Thank You, Team DishaaPro
Comments

Java Trainer

1)Array support to store all similar data types like int array,char array,float array and double array,but where as string array can support any characters like char array.2)In String array '\0' supply at last but in normal array it cont.
Comments

Technology expert

Array works for group of integer or float numbers.String works for group of characters.so.String are called as character array.
Comments

Home Tutor for Maths and Science

- String can hold only char data. Where as an array can hold any data type. - An array size can not be changed. Where as a string size can be changed if it is a char pointer - The last element of an array is an element of the specific type. The last character of a string is a null -- ‘\0’ character. -...
read more
- String can hold only char data. Where as an array can hold any data type. - An array size can not be changed. Where as a string size can be changed if it is a char pointer - The last element of an array is an element of the specific type. The last character of a string is a null – ‘\0’ character. - The length of an array is to specified in [ ] at the time of declaration (except char[]). The length of the string is the number of characters + one (null character). read less
Comments

Doing mathematics & computing from IIT Delhi

String is a type of array that store characters. But an array can store integers, float, characters etc. We do not need to define the size of a string but in case of arrays, we need to.
Comments

COMPUTER GEEK

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

Having 2 years of teaching experience

The following are the differences: 1. String can hold only char data. Where as an array can hold any data type. 2. An array size can not be changed. Where as a string size can be changed if it is a char pointer 3. The last element of an array is an element of the specific type. The last character...
read more
The following are the differences: 1. String can hold only char data. Where as an array can hold any data type. 2. An array size can not be changed. Where as a string size can be changed if it is a char pointer 3. The last element of an array is an element of the specific type. The last character of a string is a null – ‘\0’ character. 4. The length of an array is to specified in [] at the time of declaration (except char[]). The length of the string is the number of characters + one (null character). read less
Comments

C and linux Expert

Strings are similar to arrays with just a few differences. Usually, the array size is fixed, while strings can have a variable number of elements. Arrays can contain any data type (char short int even other arrays) while strings are usually ASCII characters terminated with a NULL (0) character.
Comments

View 35 more Answers

Related Questions

What is the difference between #include< > and #include" "
first one is used for predefined header files.. and second is used for user defined header files
Priya
1 0
6
What are the toughest topics in C language?
Pointers and memory management
Kavidassan
0 0
6
Which book is good for C language?
Let Us C by writer-- Yashavant P. Kanetkar (Author)
Rajendra
How do I learn C programming easily?
Just follow kanitkar book of c programming for beginners
Harsh
0 0
5
What is = and == in C language?
= is assignment operator while ==is comparision operator
Sayed
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

C Programming basics
C PROGRAMMING BASICS 10 Hours Introduction to ‘ C’ programming –fundamentals – structure of a ‘C’...
O

Om K.

0 0
0

C Program-Upper Case Demo
/*WAP to print the character entered by user in upper case*/ //Header files #include<stdio.h>#include<conio.h> //Main function void main(){ char ch; //Function for clearing screen clrscr(); ...

C for Begginers
C is an procedure oriented programming language. For any begginer the word program is new. Program: Set of instructions to be followed by machine or computer. Instruction Examples: Arithmetic instruction...

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

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

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 >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Business Process outsourcing (BPO) services can be considered as a kind of outsourcing which involves subletting of specific functions associated with any business to a third party service provider. BPO is usually administered as a cost-saving procedure for functions which an organization needs but does not rely upon to...

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