strings in c programming
coming to strings in c programming....
string is a character of array. that in this we can represent characters.
for example char s[20] means that we can write a word of character up to 19 characters.
strings data also starts from zero index on wards but the difference is to find some operations we have predefined functions like strlen(), strcpy()...etc
string can be consist of special characters.
in fact in c programming there is no such data type to indicate strings directly...
for example one program to find length of the string ....
#include<stdio.h>
void main()
{
char s[10];
scanf("%c",&s);
int n=0;
n=strlen(s);
printf("%d",n);
}
string is a character of array. that in this we can represent characters.
for example char s[20] means that we can write a word of character up to 19 characters.
strings data also starts from zero index on wards but the difference is to find some operations we have predefined functions like strlen(), strcpy()...etc
string can be consist of special characters.
in fact in c programming there is no such data type to indicate strings directly...
for example one program to find length of the string ....
#include<stdio.h>
void main()
{
char s[10];
scanf("%c",&s);
int n=0;
n=strlen(s);
printf("%d",n);
}
Comments
Post a Comment