SHARE
TWEET

Untitled

a guest Jul 16th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Èñïîëüçîâàòü øàáëîíû
  2. // Èñïîëüçîâàòü ïåðåãðóçêó
  3. //
  4.  
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7.  
  8. int *change(int *a, int s){
  9.     int i,b;
  10.     b = a[0];
  11.     a[0] = a[s-1];
  12.     a[s-1] = b;
  13.     return(a);
  14. }
  15.  
  16. float *change(float *a, int s){
  17.     int i,b;
  18.     b = a[0];
  19.     a[0] = a[s-1];
  20.     a[s-1] = b;
  21.     return(a);
  22. }
  23.  
  24. //char *change(char *a, int s){
  25. //  int i,b;
  26. //  b = a[0];
  27. //  a[0] = a[s-1];
  28. //  a[s-1] = b;
  29. //  return(a);
  30. //}
  31.  
  32. int main(){
  33.     int i;
  34.     const int size = 4;
  35.     int inarray[] = {32, 65, 12, 8};
  36.     printf("int %d\n", inarray[0]);
  37.     int* inarr = change(inarray, size);
  38.     printf("int %d\n", inarr[0]);
  39.     for(i=0;i<size;i++)printf("%d ", inarr[i]);
  40.     printf("\n");
  41.     float flarray[] = {32.5, 65.55, 12.44, 8.76};
  42.     float* flarr = change(flarray, size);
  43.     for(i=0;i<size;i++)printf("%f ", flarr[i]);
  44.    
  45. //  char* charray[] = {"Welcome"};
  46. //  char* charr = change(charray, size);
  47. //  for(i=0;i<size;i++)printf("char %d", charr[i]);
  48.    
  49. return 0;
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top