Constant.
In C programming, a string doesn't have a specific return type as it's essentially an array of characters. So, if a function is returning a string, it should be declared to return a pointer to a char (char*), since a string in C is represented as an array of characters terminated by a null character ('\0').
Since this question appears in both the C and Java sections, I'll give you the (slightly different) answers for each.In Javafinal String str; // the string we want to searchfinal char c; // the character we want to search forint num = 0; // the number of times c is in strfor(char ch: str.toCharArray()) {if( ch == c ) {++num;}}// num now equals number of times c is in strIn Cconst char* str; // the string we want to searchconst char c; // the character we want to search forint num = 0; // the number of times c is in str// loop varsint i;const int end = strlen(str);for(i = 0; i < end; ++i) {if( str[i] == c ) {++num;}}// num now equals the number of times c is in str
Because the null character represents the end of the string.
Any character can be used in string, except for \\0. char example [] = "A&B|C";
char *ptr;
Depends on several factors:number of bytes per character: 1 to 4 depending on which alphabet and character encoding you use. 1 byte per character for US-ASCII and the most common Western Europe encodings.length of the string: bytes per character times number of charactersprogramming language: in C, the string takes up no more space than the characters do. In many other languages, there is an additional fixed overhead for the string object itself. For example in Java, a string takes 2-4 bytes plus the space taken by the characters.
In C programming language, a string is an array of characters which is always terminated by a NULL character: '\0'
Some stringed instruments contain a C-string, producing sound from the string creates the note C, so it is called C-string.
special character in c language are as follows~ ' ! @ # % ^ & * () _ - + = | \ {} [] : ; " <> , . ? /
str[3]= 'A';
a -- identifier 'a' -- character-literal "a" -- string-literal
%%c %%D %%DIA c%%