Embed presentation
Download to read offline

![Definition : String
Strings are actually one-dimensional array of characters terminated by
a null character '0'.
Declaration and initialization of string
char str[6]={‘H,’e’,’l’,’l’,’o’,’0’};
Or
char str[6]=“Hello”;](https://image.slidesharecdn.com/characterarraystrings-200429135145/75/Character-array-strings-2-2048.jpg)
![ Actually, you do not place the null character at the end of a string constant. The C
compiler automatically places the '0' at the end of the string when it initializes the
array.
#include <stdio.h>
int main () {
char message[6] = {'H', 'e', 'l', 'l', 'o', '0'};
printf(“Message: %sn", message );
return 0;
}
• It is also possible to access character array by using for
loop.
• Also we can get whole string at a time and print it using
%s format specifier.](https://image.slidesharecdn.com/characterarraystrings-200429135145/75/Character-array-strings-3-2048.jpg)


Strings in C are arrays of characters terminated by a null character. They can be declared and initialized using character arrays or string literals. The C compiler automatically places a null character at the end of string constants. Strings can be accessed and printed using the %s format specifier. Common string functions include strcpy to copy strings, strcat to concatenate strings, strlen to get string length, and strcmp to compare strings.

![Definition : String
Strings are actually one-dimensional array of characters terminated by
a null character '0'.
Declaration and initialization of string
char str[6]={‘H,’e’,’l’,’l’,’o’,’0’};
Or
char str[6]=“Hello”;](https://image.slidesharecdn.com/characterarraystrings-200429135145/75/Character-array-strings-2-2048.jpg)
![ Actually, you do not place the null character at the end of a string constant. The C
compiler automatically places the '0' at the end of the string when it initializes the
array.
#include <stdio.h>
int main () {
char message[6] = {'H', 'e', 'l', 'l', 'o', '0'};
printf(“Message: %sn", message );
return 0;
}
• It is also possible to access character array by using for
loop.
• Also we can get whole string at a time and print it using
%s format specifier.](https://image.slidesharecdn.com/characterarraystrings-200429135145/75/Character-array-strings-3-2048.jpg)

