// to find the length of the string by using array
#include<stdio.h>
#include<string.h>
int main()
{
int i=0,len[21],n;
char str[8][11];
printf("no of name to be enter");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter the %d string : ",i);
scanf("%s",str[i]);
}
for(i=0;i<n;i++)
{
len[i]=strlen(str[i])-1;
}
for(i=0;i<n;i++)
{
printf("\n lenght of %d string are ",i);
printf("%d",len[i]);
}
return(0);
}
what is string
One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.
i dont no string for servlate
Here is the algorithm of the algorithm to write an algorithm to access a pointer in a variable. Algorithmically.name_of_the_structure dot name_of_the _field,eg:mystruct.pointerfield
Nothing.The C language only recognizes a few keywords, like "for" and "if". Most of what's in a C program ... that doesn't reference routines in the C program itself ... are library calls, and cputs() is one of those. What it does is write its argument (which should be a pointer to a character string) to the console... console put string.
This is an assignment not a question.
what is string
You can write 2X, where X is the length of the string.
One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.
#include<stdio.h> #include<conio.h> void main() { char string[20]; int i=0; printf("Enter the string.\n"); while(i<=19) { scanf("%c",&string[i]); i++; } while(i>=0) { printf("%c",string[i]); i--; } getch(); } In this program it is compulsory to enter 20 characters. Now we can write a program in which it is not necessary. #include<stdio.h> #include<conio.h> #include<string.h> void main() { char string[20]; int length; printf("enter the string.\n"); gets(string); length=strlen(string); length--; while(length>0) { printf("%c",string[length]); length--; } getch(); }
i dont no string for servlate
int mystrlen (const char *s) { const char *t; if (!s) return 0; for (t=s-1;*++t;); return t-s; }
We use a pointer to reference a string because a string is an array of characters where every element is a char (or a wchar_t if using UNICODE strings). Passing arrays by value would require the entire array to be copied, but passing a pointer variable to an array only copies the pointer, which is effectively the same as passing the array by reference. #include <iostream> int main() { char * psz = "hello"; // pointer to a null-terminated string. std::cout << psz; // pass the pointer (by value) to the insertion operator. return( 0 ); }
Here is the algorithm of the algorithm to write an algorithm to access a pointer in a variable. Algorithmically.name_of_the_structure dot name_of_the _field,eg:mystruct.pointerfield
Nothing.The C language only recognizes a few keywords, like "for" and "if". Most of what's in a C program ... that doesn't reference routines in the C program itself ... are library calls, and cputs() is one of those. What it does is write its argument (which should be a pointer to a character string) to the console... console put string.
i am sam
what is if(!(str[i]==32))