Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
p30
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//Title of this code //gcc 4.8.2 #include <stdio.h> #define MAXLINE 1000 /* maximum input line length */ int getline(char line[], int maxline); void copy(char to[], char from[]); int getline(char s[], int lim) { int c,i; for(i=0;i<lim-1 && (c=getchar())!=EOF && c!='\n';i++ ){s[i]=c;} // ++i; s[i]='\0'; return i; } void copy(char lgst[],char l[]) { int i; for(i=0;l[i]!= '\0';i++){lgst[i]=l[i];//printf("%d",longest[i]); } //printf('\n'); // l[i]="\0"; } int main(void) { int max=0,apel=0; char line[MAXLINE];//current char longest[MAXLINE]; //--------------------------------------- while((apel=getline(line ,MAXLINE)) > 0) if(max<=apel){max=apel; copy(longest,line); } // else printf("%s",longest); for(int i=0;longest[i]!= '\0' && longest[i]!= '\n';i++)printf("%c",longest[i]); //--------------------------------------- // //--------------------------------------- return 0; }
g++
kjsdfvfrg egsdfvv fhm
Show compiler warnings
[
+
] Compiler args
[
-
]
Show input
Compilation time: 0.24 sec, absolute running time: 0.15 sec, cpu time: 0 sec, memory peak: 3 Mb, absolute service time: 0.41 sec
edit mode
|
history
|
discussion