Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.19 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. struct cimek{
  5.     int *min;
  6.     int *max;
  7.     int *elso;
  8.     int *utolso;
  9. };
  10.  
  11. int main()
  12. {
  13.     // 111001 000110
  14.     struct cimek cim;
  15.     int N = 10;
  16.     int* t= (int*) malloc(sizeof (int)*N);
  17.     for (int i =0;i<N;i++)
  18.     {
  19.      scanf("%d",t[i]);
  20.     }
  21.     for (int i =0;i<N;i++)
  22.     {
  23.      printf("%d ",t[i]);
  24.     }
  25.     printf("\n");
  26.     int szam;
  27.     scanf("%d",&szam);
  28.     struct cimek a;
  29.     struct cimek* ap = (struct cimek*) malloc(sizeof (struct cimek));
  30.     int min_idx=0;
  31.     for (int i=1;i<N;i++)
  32.     {
  33.         if(t[i] < t[min_idx])
  34.         {
  35.             min_idx = i;
  36.         }
  37.     }
  38.     //int *min_ptr = t[min_idx];
  39.     //ap->min = min_ptr;
  40.     //a.min = min_ptr;
  41.     int* max_ptr = &t[0];
  42.     for(int i = 1;i<N;i++)
  43.     {
  44.         if(t[i]>*max_ptr)
  45.         {
  46.             max_ptr = &t[i];
  47.  
  48.         }
  49.     }
  50.     ap->max = max_ptr;
  51.     a.max = max_ptr;
  52.     int* elso_ptr = NULL;
  53.     int* utolso_ptr = NULL;
  54.     for(int i =0;i<N;i++)
  55.     {
  56.         //
  57.     }
  58.     ap->elso = elso_ptr;
  59.     a.elso = elso_ptr;
  60.     ap->utolso = utolso_ptr;
  61.     a.utolso = utolso_ptr;
  62.     free(ap);
  63.     free(t);
  64.     return 0;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement