String is a collection of symbols. String is a set of symbols. String is also called set of characters.
We can use alphabets,digits and special characters in string.
Alphabets:- A, B, ….., Y, Z a, b, ……, y, z Digits :- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Special symbols :- ~ ‘ ! @ # % ^ & * ( ) _ - + = | \ { } [ ] : ; " ' < > , . ? /
\0 represents NULL.
"string.h" header file include in your program.
%s placeholder is used to print value of string.
Syntax
char variableName[ ] ={'symbol-1', 'symbol-2',........,'\0'};
example:
char str[ ] = {'c', 'o', 'm', 's', 'y', 's', 'a', 'p','p', '.', 'c', 'o', 'm', '\0'};
If a value is given in double quotes ("") it is called string.
Syntax
char variableName[size] = value;
example:
char str[size] = "HELLO WORLD";
Syntax
char variableName[size];
example:
char str[size];
gets() is a predefined function. It is used to read string value from user.
puts() function is predefined function. It is used to print value of string.
It is predefined function. It returns length of string.
It is a predefined function.
It is used to copy from source variable and paste in destination variable.
Syntax
strcpy(destination, source);
It is used to concatenate strings.
Syntax
strcat(string_1,string_2);
It is a predefined function. It check two string is equal or not. If both strings are equal then it returns 0.
Syntax
strcmp(string_1,string_2);
It prints reverse of string.
It converts uppercase string into lowercase.
It converts lowercase string into uppercase.
Comsysapp.com is an educational website. Students and software developers can learn programming language tutorials. Comsysapp is very useful for beginners and professional developers. Comsysapp provides tutorial in easy language. Comsysapp.com has focus on simplicity.
Comsysapp.com provides free tutorials like c, html, css, etc. All tutorials are free for beginner and professionals.
comsysapp.com is not responsible for any mistake. We are not responsible if information made available on our website is incomplete or invalid. But comsysapp.com always try for zero-zero mistake.
comsysapp.com does not collect any data from users. We use Google AdSense advertising on our website. We never ask personal or private information.
copyright © 2023