Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct cimek{
- int *min;
- int *max;
- int *elso;
- int *utolso;
- };
- int main()
- {
- // 111001 000110
- struct cimek cim;
- int N = 10;
- int* t= (int*) malloc(sizeof (int)*N);
- for (int i =0;i<N;i++)
- {
- scanf("%d",t[i]);
- }
- for (int i =0;i<N;i++)
- {
- printf("%d ",t[i]);
- }
- printf("\n");
- int szam;
- scanf("%d",&szam);
- struct cimek a;
- struct cimek* ap = (struct cimek*) malloc(sizeof (struct cimek));
- int min_idx=0;
- for (int i=1;i<N;i++)
- {
- if(t[i] < t[min_idx])
- {
- min_idx = i;
- }
- }
- //int *min_ptr = t[min_idx];
- //ap->min = min_ptr;
- //a.min = min_ptr;
- int* max_ptr = &t[0];
- for(int i = 1;i<N;i++)
- {
- if(t[i]>*max_ptr)
- {
- max_ptr = &t[i];
- }
- }
- ap->max = max_ptr;
- a.max = max_ptr;
- int* elso_ptr = NULL;
- int* utolso_ptr = NULL;
- for(int i =0;i<N;i++)
- {
- //
- }
- ap->elso = elso_ptr;
- a.elso = elso_ptr;
- ap->utolso = utolso_ptr;
- a.utolso = utolso_ptr;
- free(ap);
- free(t);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement