answersLogoWhite

0


Best Answer

There is no difference. A string is just an array of type char. The only real difference is that we do not need to keep track of the length of a string because strings are null-terminated in C. If a string does not have a null-terminator, then it is just an ordinary array of character values.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between Strings and Arrays in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the Difference between arrays in c and c plus plus?

Nothing whatsoever. They are exactly the same.


What are Strings in C programming?

Arrays of chars are strings. there is a built in librray, that handles string string.h but the data-type is held as arrays of chars. char[10] c="string"; translate to ['s','t','r','i','n','g',\0] Arrays of chars are strings. there is a built in librray, that handles string string.h but the data-type is held as arrays of chars. char[10] c="string"; translate to ['s','t','r','i','n','g',\0]


What is type string in C?

Nothing, zero-terminated char-arrays are used instead of strings.


How can you do the same thing as the program below but using strings and arrays in C language?

Program below?!


What is the main difference between the violin and viola?

A viola has the (left to right) C,G,D,A strings and the violin has G,D,A,E strings


What is the main difference between a violin and viola?

A viola has the (left to right) C,G,D,A strings and the violin has G,D,A,E strings


How do you print my name in c program in vertical manner using arrays?

you need strings to print any character(your name) this is not possible useing array:D


What is the difference between forward slash and backward slash in c?

forward slash - division operator backward slash - special character (e.g. \n - newline) in C strings


How do you swap two arrays in c plus plus using string?

You can't. While a string is a character array, an array is not necessarily a string. Treating arrays as if they were strings simply to swap them is madness. The correct way to physically swap arrays A and B is to copy A to a new array, C, then copy B to A, then C to B. If the arrays are the same size this is not a problem. If they are different sizes, you can only swap them if they are dynamic (not static). This means you must reallocate them. To speed up the process, copy the smallest array to C, first. A much better approach would be to point at the two arrays and swap the pointers instead.


What is the required syntax for creating C arrays?

The required syntax for creating C arrays include the brackets, array size, variety length arrays, codes like std:vector, classPTR, and many more to create C arrays.


Difference between null and empty in c plus plus?

NULL is a constant with the value zero. It is typically used with pointers to signify the pointer is valid, but it does not store a valid memory address. In other words it points at nothing in particular. It is nullified. All pointers that are not currently in use must be nullified to signify the fact they are not in use. The term empty applies to arrays that have no elements: empty arrays. We also use the term when referring to empty strings. A string is simply an array of char, but while null-terminated strings always have at least one char, the null-terminator, the string itself is empty.


How are string stored in c language?

Strings represented by the language character set (e.g., ASCII) are stored as null-terminated arrays of type char. Wide-character strings are stored as null-terminated arrays of type wchar_t. Other types are also available, such as char16 and char32 (for UTF16 and UTF32 encodings, respectively).