Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h> //looking for the longest line, not sure where this come from, and how it's working
- #define MAXLINE 1000
- int get_line(int [],int);
- void copy(int [],int []);
- int main()
- {
- char ar[MAXLINE],max_ar[MAXLINE]= "odin dva tri";
- int c,result, max = 0;
- while((result = get_line(ar,MAXLINE))!=EOF)
- {
- if(result>max)
- {
- max = result;
- copy(max_ar,ar);
- }
- }
- printf("max is %d\n",max);
- return 0;
- }
- void copy(int from[],int to[])
- {
- int i = 0;
- while( (to[i]=from[i]) !='\0')
- i++;
- }
- int get_line(int arr[],int s)
- {
- int i,c;
- for(i=0;i<s && (c=getchar())!=EOF&&(c!='\n');i++)
- {
- arr[i] = c;
- }
- return i;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement