how to find string length wihtout using c function?
Answers were Sorted based on User's Feedback
Answer / vignesh1988i
#include<stdio.h>
#include<conio.h>
int str_len(char *)
void main()
{
char s[30];
int count;
printf("enter the string :");
gets(s);
count=str_len(s);
printf("the length is :%d",count);
getch();
}
int str_len(char *a)
{
int i=0;
while(*a!='\0')
a++;
i++;
}
return i;
}
thank u
| Is This Answer Correct ? | 5 Yes | 3 No |
Answer / j.j.anand kamlesh
void main()
{
int i;
char ch[100];
printf("ENTER THE STRING :");
gets(ch);
for(i=1;ch[i];i++);
printf("THIS IS THE LENGTH : %d",i);
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / ankitecian
int StrLen(const char *_input)
{
int _len = 0;
while( *(_input + _len) != NULL)
{
_len++;
}
return _len;
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ruchi
#include<conio.h>
#include<stdio.h>
int main()
{
char a[10];
int i=0,c,length=0;
printf("\nEnter the string ");
while((a[i++]=getchar())!='\n');
printf("\nThe lengh of the string is ");
i=i-1;
printf("%d",i);
getch();
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ramesh
# include <stdio.h>
# include <conio.h>
void main()
{
int i;
char sring[100];
printf("ENTER THE STRING :");
gets(string);
for(i=1;string[i];i++);
printf("LENGTH IS : %d",i);
}
| Is This Answer Correct ? | 0 Yes | 0 No |
why little endian and big endian came?y they using differently? y they not used commonly ?wt is application of little and big ?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
Explain how can I read and write comma-delimited text?
What is c programing language?
int n=1; while(1) { switch(n) { case 1:printf("a"); n++; continue; case 2:printf("b"); n++; continue; default : printf("c"); break; } break; }
what do structure language means?
What is c language & why it is used?
Why cann't whole array can be passed to function as value.
Why is c called c?
main() { char *p1="Name"; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf("%s\n",p2); } what is the output?
7 Answers AMCAT, HCL, Ramco, Zycus Infotech,
How do you redirect a standard stream?
program to find which character is occured more times in a string and how many times it has occured? for example in the sentence "i love india" the output should be i & 3.