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 malloc is faster than calloc?
Combinations of fibanocci prime series
What is identifiers in c with examples?
write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list
Why header file is used in c?
What is break statement?
What is the correct code to have following output in c using nested for loop?
code for find determinent of amatrix
why program counter is 16 bit?
void main() { static int i = 5; if(--i) { main(); printf("%d ",i); } } what would be output of the above program and justify your answer? }
5 Answers C DAC, CDAC, Infosys, Wipro,
please give me some tips for the selection in TCS.
The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?