Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
MEMORIA DINAMICA FUNCIONA
#include <stdio.h> #include <stdlib.h> #include <time.h> void aleatorio(int *, int ); int main (){ int j ; int N = 15; int *vector ; vector = (int*)malloc(N*sizeof(int)); if (vector == NULL ){ printf("no se pudo reservar memoria"); exit(1); } aleatorio(vector,N ); 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--; } else{ j++; } } } vector = (int*)realloc(vector,N*sizeof(int)); if (vector == NULL){ printf("no se pudo blabkla"); exit(1); } for (int t = 0 ; t < N ; t++){ printf("%d, ",*(vector+t)); } printf("\n"); system("pause"); return 0 ; } void aleatorio(int *vector , int N ){ srand(time(NULL)); for (int i = 0 ; i < N ; i++){ *(vector+i) = rand()%5; printf("%d ",*(vector+i)); } printf("\n"); }
run
|
edit
|
history
|
help
0
Sorting Character array using Qsort
20171116_PI
5 trabajo semanal 4
Greeting
B_141121_factorial01
funcion quicksort
b=1 c=1
alphabet2 pyramid right
USO DEL strrchr()
example of scanf and basic integer manipulation