daily pastebin goal
70%
SHARE
TWEET

Untitled

a guest Jun 2nd, 2012 31 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #define m 1000
  4. int gtline(char x[],int y)/*takes the string nd return it's length */
  5. {
  6.     int i=0,c;
  7.     while(--y > 0 && (c=getchar() != EOF) && c != '\n')
  8.         x[i++] = c;
  9.     if(c = '\n')
  10.         x[i++] = c;
  11.     x[i] = '\0';
  12. return i;    
  13. }
  14. void main()
  15. {
  16.     char x[m];
  17.     printf("enter the string");
  18.     printf("length is %d",gtline(x,m));
  19.     return (EXIT_SUCCESS);
  20. }
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top