Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Ahora si?
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
#include <stdio.h> #include <stdlib.h> #include <time.h> void aleatorio (int *, int); void clean (int *, int*); int main(){ int *vector ; int N = 10 ; vector = (int*)malloc(N*sizeof(int)); if (vector == NULL){ printf("no se pudo reservar espacio en la memorioa"); exit(1); } aleatorio(vector,N); clean(vector,&N); } void aleatorio ( int *vector, int N ){ srand(time(NULL)); for (int i = 0 ; i < N ; i++){ *(vector+i) = rand()%4; if ( i+1 < N ) printf("%d, ",*(vector+i)); else printf("%d.",*(vector+i)); } printf("\n"); } void clean(int *vector, int *N){ int j ; for (int i = 0 ; i < *N ; i++){ j = i +1 ; while(j < *N ){ if (*(vector+i) == *(vector+j)){ for (int k = j ; k+1 < *N ; k++){ *(vector+k) = *(vector+k+1); } *N = *N -1 ; } else{ j++; } } } for (int t = 0 ; t < *N ; t++){ printf("%d, ",*(vector+t)); } printf("\n el nuevo valor de N es de %d.",*N); }
gcc
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 0.12 sec, absolute running time: 0.16 sec, cpu time: 0.01 sec, memory peak: 5 Mb, absolute service time: 0,55 sec
edit mode
|
history
|
discussion
Error(s):
sh: 1: pause: not found
3 0 4 2 3 4 2 1 1 4 2 2 4 0 2 3, 0, 4, 2, 1,