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

How can I avoid the error messages?
When there is a syntax error in the program the compiler indicates it by giving error messages. By following proper syntax we can avoid error messages. Syntax is like grammar rules of english language.
Yusufali
I’ve been learning C language for 3 weeks but it’s becoming more difficult. As a result, I’m becoming lazy. What should I do to motivate myself?
Learn algorithm or flowchart first. Once you start C, try to relate with real time example. Example: When learn printf() , think about a a bill where you customer information is printed. Similarly when...
Akhilesh
0 0
5
Why does execution of a program in C/C++/Java start from only main?
Main function is calling the other functions of he program and compiler gets this direction while Compiling the code. If it does not find main function then it will also not find the other functions in the code. So, main is required in C program.
Isha
How do I get 6 power 13 in c language?
#include <stdio.h> #include <math.h> int main() { double result = pow(6, 13); printf("6 to the power of 13 is: %f ", result); return 0; }
Raju
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

Variables
Variables in C Language:A variable is a name that may be used to store a data value. Unlike constant, variables are changeable, we can change value of a variable during execution of a program. A programmer...

INTRODUCTION TO PROGRAMMING LANGUAGES
Language is a medium for communication. If we want to perform anything with another person, we can know the human language as a human being. Similarly, if we want to perform anything with a computer, we...


C Program-Prime Number
/*WAP to print a number entered by the user is prime or not*/ //Header files #include<stdio.h>#include<conio.h> //Main function void main(){ int num,i; //Function for clearing screen clrscr();...

Some interview questions and answers for fresher level on Pointers
What is a void pointer? Void pointer is a special type of pointer which can reference or point to any data type. This is why it is also called as Generic Pointer. As a void pointer can point to...

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