File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ # Strings in C
2+ #### Strings are used for storing text/characters.
3+ #### For example, "Hello World" is a string of character
4+ #### Strings are used to store sequence of characters as information.
5+ #### string.h header file provides some built-in string manipulation functions.
6+
7+ ```
8+ char greetings[] = "Hello World!";
9+ char a[5] = {‘H’,’o’,’l’,’a’};
10+ char a [ ] = “Hola”;
11+ ```
12+
13+ # String functions are accessible by importing * <string.h>* .
14+ #### strlen() Find length of string
15+ #### strcpy() Copy one string to other
16+ #### strcat() Join two strings
17+ #### strcmp() Compare two strings
18+ #### strlwr() Converts string to lowercase
19+ #### strupr() Converts string to uppercase
20+
Original file line number Diff line number Diff line change 1+ #include <stdio.h>
2+ #include <string.h>
3+
4+ int main ()
5+ {
6+ // declare and initialize string
7+ char str [] = "nazu" ;
8+
9+ // print string
10+ printf ("%s\n" , str );
11+
12+ int length = 0 ;
13+ length = strlen (str );
14+
15+ // displaying the length of string
16+ printf ("Length of string str is %d" , length );
17+
18+ return 0 ;
19+ }
You can’t perform that action at this time.
0 commit comments