C Strings

Characters arrays are called strings.
A String constant is a a one-dimensional array of characters terminated by a null(‘\0’).

Each Character occupy one byte of Memory.
String is important for characters.

or    We can say that Strings are the form of  data used in programming for storing and manipulating text, such as words, name and sentences.

Example :-
char num[]={‘T’,’u’,’t’,’o’,’r’,’i’,’a’,’l’,’w’,’o’,’r’,’l’,’d’};

Memory Allocaiton in String

String Example :-

#include<stdio.h>
#include<conio.h>
void main()
{
char n1[]={‘T’,’u’,’t’,’o’,’r’,’i’,’a’,’l’,’w’,’o’,’r’,’l’,’d’,0};
char n2[]=”Tutorialworld”;
clrscr();
printf(“\n%s”,n1);
printf(“\n%s”,n2);
getch();
}

Result :-

String Example

 

  A Program to sort the names in alphabetical order.

    Write a Program for Selection Sort.

   Write a Program for Bubble Sort.

  Write a Program for Insertion Sort.




Follow Us

Contact Us

tutorialworldin@yahoo.com

Back to Top