Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Pregunta 5
- Construya una función llamada f1 que recibe dos punteros a variables estructura del tipo st
- y retorna un puntero a la variable estructura que tiene el campo c1 menor o NULL si son iguales.
- struct st {
- int c1;
- int c2;
- };
- */
- #include <stdio.h>
- struct st{
- int c1;
- int c2;
- };
- struct st* f1(struct st*p1,struct st*p2);
- main(){
- struct st pico={
- 10,
- 15,
- };
- struct st taldo={
- 5,
- 2,};
- printf("%d",f1(&pico,&taldo)->c1);
- getchar();
- getchar();
- }
- struct st* f1(struct st*p1,struct st*p2){
- if(p1->c1< p2->c1)
- return p1;
- if(p2->c1 <p1->c1)
- return p2;
- if(p2->c1==p1->c1)
- return NULL;
- }
Add Comment
Please, Sign In to add comment