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

Explain how can I pad a string to a known length?

0 Answers  


Why can’t constant values be used to define an array’s initial size?

0 Answers  


How can you increase the size of a dynamically allocated array?

0 Answers   TISL,


24.what is a void pointer? 25.why arithmetic operation can’t be performed on a void pointer? 26.differentiate between const char *a; char *const a; and char const *a; 27.compare array with pointer? 28.what is a NULL pointer? 29.what does ‘segmentation violation’ mean? 30.what does ‘Bus Error’ mean? 31.Define function pointers? 32.How do you initialize function pointers? Give an example? 33.where can function pointers be used?

2 Answers  


There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take turns to remove these eggs from the baskets. On each turn, a player must remove at least one egg, and may remove any number of eggs provided they all belong to the same basket. The player picking the last egg(s) wins the game. If you are allowed to decide who is going to start first, what mathematical function would you use to decide so that you end up on the winning side? Upload a C program to demonstrate the behaviour of the game.

2 Answers  


Why is c called c?

0 Answers  


difference between Low, Middle, High Level languages in c ?

0 Answers   Bosch, Infosys,


What is true about the following C Functions (a) Need not return any value (b) Should always return an integer (c) Should always return a float (d) Should always return more than one value

2 Answers   DynPro, 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  


What are the advantages and disadvantages of pointers?

0 Answers  


Explain how can I read and write comma-delimited text?

0 Answers  


What is c language & why it is used?

0 Answers  


Categories