Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdarg.h>
- //de revazut
- float *allocVec(int n,...)
- {
- va_list va;
- int i;
- va_start(va,n);
- double *v;
- if((v=(double *)malloc(n*sizeof(double)))==NULL)
- {
- printf("EROARE");
- exit(EXIT_FAILURE);
- }
- for(i=0; i<n; i++)
- {
- v[i]=va_arg(va,double);
- }
- printf("{ ");
- for(i=0; i<n; i++)
- {
- printf("%g ", v[i]);
- }
- va_end(va);
- printf("}\n");
- free(v);
- exit(EXIT_FAILURE);
- }
- int main()
- {
- allocVec(3,7.2,(double)-1,0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement