Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
string.c
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
//gcc 5.4.0 #include <stdio.h> #include <string.h> int main(void) { char buf[80] = "venkata kona chandra reddy lokireddy "; int i=0,j=0,len=0; char *buf1 ,*buf2; printf("Enter the Statement\n"); //fgets(buf,sizeof(buf),stdin); buf1 = malloc(80); buf2 = malloc(80); printf("Statement= %s\n",buf); while(buf[i]) { if(buf[i] != ' ') { buf1[j++]=buf[i]; // printf("j = %d\n",j); } else { if (len < j){ len = j; strcpy(buf2,buf1); printf("buf2 =%s,buf1=%s len =%d\n",buf2,buf1,len); } j=0; } i++; } printf("string = %s,length = %d\n",buf2,len); return 0; }
gcc
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 0.12 sec, absolute running time: 0.07 sec, cpu time: 0.01 sec, memory peak: 3 Mb, absolute service time: 0,28 sec
edit mode
|
history
|
discussion
Enter the Statement Statement= kona chandra reddy string = chandra,count = 7