answersLogoWhite

0


Best Answer

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

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Is string is an predefined data types in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
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


Is main a predefined function in c?

yes


What are the predefined stream objects in c?

printer


What is the syntax for string in c?

The C programming language has no notion of a string. The C runtime libraries interpret a string as an array of 'char' (sometimes 'unsigned char'), where a byte (char) with numerical value zero (often written as '\0' in C) denotes the end of the string. Modern variations also support modern forms of strings based on different data types (wchar, etc) in order to support more complex encodings such as Unicode. These, too, are interpretations of combinations of language features, but not a built-in part of the language.