1 #include<stdio.h>
2 int main()
31 {
4. char str[25] = "Josh";
5 printf ("%d", sizeof(str));
6
return 0;
7 }
Answers
Answer:
4
Explanation:
In computer programming, a string is a traditional sequence of characters, either as a literal constant or some kind of variable. The latter may allow its elements to get mutated and the length changed, or it might be fixed (after creation). A string is generally considered as data type and is often implemented as array data structure of bytes (or words) that stores a sequencial elements, typically character, using some of the character encoding. String may also denote more general array or any other sequence (or list) data type and structure.
Depending on the programming language and precised data type used, a variable declare to be a string may either cause storages in memory to be statically allocated to a predetermined maximum length or employ dynamic allocation for allowing it to hold a variable number of elements.
When a string appears literally in the source code, it is known as a string literal or an anonymous string.
In formal languages, which are mostly used in mathematical logic and theoretical computer science, a string is called a finite sequence of symbols that are chosen from a set called an alphabet.
Contents
1 String datatype
1.1 String lengths
1.2 Character encoding string
1.3 Implementation
1.4 Representation
1.4.1 Null-termination
1.4.2 Byte- and bit-termination
1.4.3 Length-prefixed
1.4.4 Strings as record
1.4.5 Other representation
1.5 Security concern
2 Literal string
3 Non-text string
4 String processing algorithm
5 Character string-oriented language and utilities
6 Character string function
7 Formal theory
7.1 Concatenation and substring
7.2 Prefix and suffix
7.3 Reversal
7.4 Rotation
7.5 Lexicographical ordering
7.6 String operation
7.7 Topology
8 See also
9 Reference
#SPJ2