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 |
Program to write some contents into a file using file operations with proper error messages.
hOW Can I add character in to pointer array of characters char *a="indian"; ie I want to add google after indian in the char *a
what is output of the following statetment?Printf(“%x”, -1<<4); ?
What is the difference between functions getch() and getche()?
Explain void pointer?
Ow can I insert or delete a line (or record) in the middle of a file?
1)what are limitations for recursive function? 2)write a program to read a text file and count the number of characters in the text file
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
What is Generic pointer? What is the purpose of Generic pointer? Where it is used?
What is the concatenation operator?
provide an example of the Group by clause, when would you use this clause
Give a method to count the number of ones in a 32 bit number?