Category: Strings in C

Program to Calculate Length of a String (Using strlen in-built function) 5

Program to Calculate Length of a String (Using strlen in-built function)

#include #include #include void main(){ int strlength; char *str; clrscr(); printf(“\nEnter the string: “); gets(str); strlength=strlen(str); printf(“\nThe length of the string is %d.”,strlength); getch(); } Output: Enter the string: Learn C Online The length of the string is 14.

Strings in C Programming Language 19

Strings in C Programming Language

A string in C is a series of characters in a group that occupy contiguous memory. A group of characters (Alphabets, digits and special characters) is called as a string. Example 1: “Thank you for visiting www.learnconline.com” “www.learnconline.com is excellent site for beginners. This is example of strings in C.” A string in C should always be enclosed with in double quotes (“). If single quote is used then it is treated as character. Hence ‘A’ is different from “A”. Every string ends with a null character (‘\0’). Note that \0 is a single character. So when it has to...

FREE C Cheatsheet - Speed Up Your C Programming.

FREE C Cheatsheet - Speed Up Your C Programming.

Download a 7-page free cheat sheet for easy and quick access to C Concepts, Snippets, and Syntax.

Thank you! Check you inbox and access your cheat-sheet