Tuesday, 26 March 2013

Character Array Or a String


By on 07:03

Character Array Or a String is the sequence of characters which are used to create meaningful programs.String is terminated by null character(\o).

input=gets()

output=puts()

String(Formatting)=%s

Declaration and Initialisation of String:-

Syntax:-

data type string name[size];

Example:-

char string[40];

Some important operation performed in a string:-

1)Read and Write string

2)Add string

3)Copy string

4)Concatenate string

5)Compare string etc.

Simple/Basic program of Character Array Or a String:-

Q)Write a program to enter string and display the string.

Note:-You can also create this program in c++(c plus plus),java,c#(c sharp) languages etc. with the same logic(Functions may be differ).


P:void main()
{
char string[40];
printf("Enter String");
gets(string);
printf("String are as follows");
puts(string);
getch();
}

If you have any query then leave your comments and don't forgot to follow me on Google+,Facebook,Twitter.

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...