how to find string length wihtout using c function?

Answers were Sorted based on User's Feedback



how to find string length wihtout using c function?..

Answer / ivr

char *a="india";
for(i=0;a[i]!='\0';i++);
printf("the length is :%d",i);

Is This Answer Correct ?    10 Yes 1 No

how to find string length wihtout using c function?..

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

how to find string length wihtout using c function?..

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

how to find string length wihtout using c function?..

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

how to find string length wihtout using c function?..

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

how to find string length wihtout using c function?..

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

Post New Answer

More C Interview Questions

Why malloc is faster than calloc?

0 Answers  


Combinations of fibanocci prime series

0 Answers  


What is identifiers in c with examples?

0 Answers  


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

0 Answers   Persistent,


Why header file is used in c?

0 Answers  






What is break statement?

0 Answers  


What is the correct code to have following output in c using nested for loop?

0 Answers  


code for find determinent of amatrix

0 Answers  


why program counter is 16 bit?

3 Answers  


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.

3 Answers   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?

0 Answers  


Categories