Advertisement
XeBuZer0

Example of basic pointer to struct in C Language and operators.

Jun 2nd, 2023 (edited)
1,050
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. typedef struct myType{
  5.     int x;
  6.     int y;
  7. } miTipo;
  8.  
  9. int main(void){
  10.     miTipo *z = NULL;
  11.     z = calloc(1,sizeof(miTipo));
  12.     z -> x = 10;
  13.     (*z).y = 15;
  14.     printf("primero: %i, segundo: %i\n", z->x , (*z).y);
  15.     free(z);
  16.     return 0;  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement