answersLogoWhite

0

No. In C string is an array of characters terminated by a null character (a character having ascii value 0).In more high level languages like C# and Java string is a predefined data type and hence limits the operation on string by some pre-defined library functions. But C provides complete control over strings.The Following step shows declaration of a string in various methods.

char str[6] = {'h' . 'e'. 'l'. 'l'. 'o'.'\0'};

One thing you need to notice is that the size of the character array should be atleast 1 greater than the number of characters in the string for accommodating the null character.

but

char str[] = "hello";

statement appends the null character automatically and no need to specify the length of the array (of course you can specify it if you want). The compiler automatically allocates the memory according to the length of the string.

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

What is primare datatype in c?

primary datatypes means the data types which are provided by developer of language himself like int,float,double,char are the primary data types in c language where as the String,array are nothing but the derived data types. for Ex.we derived the String data type from char datatype using array system.


What is premitive?

In C program, premitive is a kind of data type which is predefined in C programming language.


Why to use String in c?

C doesn't have String data-type, so don't use it.


Why String data type cannot be used as built-in data type in C?

Because it isn't a built-in data-type in C. Other examples that aren't built-in data-types: complex numbers, binary trees, associative-arrays.


Describe the four basic data types in c?

Describe the basic data types in C Describe the basic data types in C


Which type of data is non-numerical?

Non numerical data includes :String or Text sentencesCharacters : a single character like 'c' or '1' or '$'Objects : which consist of other basic types of data, but are not numerical themselves


What is the range of data types in C programming language?

The ranges for all data types in C are implementation-defined.


Why percentage i is not used for integer data-type in c language?

C is statically typed. There is no need for dollar or percentage symbols to differentiate between character/string data and numeric data.


How constant are used in c?

it is predefined function


What are the predefined stream objects in c?

printer


Is main a predefined function in c?

yes


Class data types in c?

The data types indicate the type of values that can be stored. The primary data types in c are:1. int, short, long, long long - used for integer values2. float, double - used for storing floating point numbers3. char - used for storing ASCII characters