Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. int main () {
  2. float x[4] = { 1, 2, 3, 4 };
  3. int position = 3;
  4. float* total = malloc(7 * sizeof(float));
  5.  
  6. memcpy(total, x,(position-1) * sizeof(float));
  7. memcpy(total + position-1, x+position, (4-position)* sizeof(float));
  8. int length = sizeof(total)/sizeof(int);
  9. printf("%dn",length);
  10. for( int x=0; x<3; x++)
  11. {
  12. printf("Value of var is: %f n",total[x]);
  13. }
  14. return(0);
  15. }
  16.  
  17. //función con el codio de arriba
  18. int* quitarElemento(vector,posicion);
  19. int main(){
  20. int tamano = 9;
  21. int* vector = (int *)malloc(sizeof(int)*tamano );
  22. for (size_t i = 0; i < tamano ; i++) {
  23. vector [i]=i;
  24. }
  25. vector = quitarElemento(vector,posicion);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement