Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
AVANCE 1 TAREA M4 - PERLAS
#include <stdio.h> #include <stdlib.h> typedef unsigned long UL; typedef unsigned long long ULL; // ----------------Prototipos----------------------- UL *input(UL *, ULL *); void output(UL *, ULL); // ---------------Función Principal----------------- int main(void) { UL *perlas; ULL total ; while (1) { perlas = NULL; total = 0; perlas = input(perlas, &total); if (total == 0) break; if ( total % 2 == 0 ) printf("NO\n"); else { printf("%llu\n", total); //printf("%lu\n", perlas[0]); output(perlas, total); } } return 0; } // ----------------------Funciones-------------------- UL *input(UL *ptrPerlas, ULL *N) { UL diametro; UL *ptrAux = ptrPerlas; do { scanf("%lu", &diametro); if ( diametro == 0 ) break; ptrPerlas = (UL *) realloc(ptrPerlas, sizeof(UL) * ( (*N) + 1 ) ); if ( ptrPerlas == NULL) exit(EXIT_FAILURE); ptrPerlas[*N] = diametro; (*N) ++; }while(1); return ptrPerlas; } void output(UL *perlas, ULL N) { ULL i; for ( i = 0 ; i < N ; i ++ ) printf("%lu ", perlas[i]); printf("\n"); }
run
|
edit
|
history
|
help
0
primeno
struct
print_odd_pointer.c
Project 5 v.08
PREGUNTA 3 - MODULO 4 TERMINADA
example of scanf and basic integer manipulation
new
Media de 3 numeros
C_141105_PuntosTriangulo
Binary example