Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #define m 1000
- int gtline(char x[],int y)/*takes the string nd return it's length */
- {
- int i=0,c;
- while(--y > 0 && (c=getchar() != EOF) && c != '\n')
- x[i++] = c;
- if(c = '\n')
- x[i++] = c;
- x[i] = '\0';
- return i;
- }
- void main()
- {
- char x[m];
- printf("enter the string");
- printf("length is %d",gtline(x,m));
- return (EXIT_SUCCESS);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement