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

In cryptography, you could often break the algorithm if you know what was the original (plain) text that was encoded into the current ciphertext. This is called the plain text attack. In this simple problem, we illustrate the plain text attack on a simple substitution cipher encryption, where you know each letter has been substituted with a different letter from the alphabet but you don’t know what that letter is. You are given the cipherText as the input string to the function getwordSets(). You know that a plain text "AMMUNITION" occurs somewhere in this cipher text. Now, you have to find out which sets of characters corresponds to the encrypted form of the "AMMUNITION". You can assume that the encryption follows simple substitution only. [Hint: You could use the pattern in the "AMMUNITION" like MM occurring twice together to identify this]

0 Answers   Infosys,


How do I declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

2 Answers   CMC, Wipro,


write a program without using main function?

2 Answers   TCS,


What are logical errors and how does it differ from syntax errors?

0 Answers  


Mention four important string handling functions in c languages .

0 Answers  






What are global variables and explain how do you declare them?

0 Answers  


Why main is used in c?

0 Answers  


Whether there can be main inside another main?If so how does it work?

14 Answers   Sail, Wipro,


Is there anything like an ifdef for typedefs?

0 Answers  


What library is sizeof in c?

0 Answers  


What is the difference between procedural and functional programming?

0 Answers  


What are the ways to a null pointer can use in c programming language?

0 Answers  


Categories