Reading of data type NodeL

0

What type of variable identifier is used to read a node-type variable?

Throw the following error

  

warning: format '% lu' expects argument of type 'long unsigned int *', but argument 2 has type 'nodeL * {aka struct node *}

#include <stdio.h>
#include <conio.h>

typedef struct nodo
{
    int info;
    struct nodo *sig;
} nodoL;

int main(void) {
    nodoL n;
    scanf("%lu", &n);
    printf("%x\n", n.info);

    return 0;
}
    
asked by Alejandro Caro 14.09.2017 в 00:05
source

1 answer

0
  

What type of variable identifier is used to read a node-type variable?

There is no identifier for that type and the reason is that it is a type defined by the user.

scanf is only enabled to store values in the native types, which are the ones that know the language standard: int , char , float , double , char* (for chains) , ...

The user-defined types eventually end up using native types below. What you have to do is create functions that modify those variables. The structures are nothing more than a mechanism that allows grouping and organizing native types to improve the readability and clarity of the code.

EDITO

Question made via comment:

  

And how do you read a node-type variable?

The variable of type nodo is not read ... what you have to do is fill in the native variables it has inside:

scanf("%d", &n.info);
    
answered by 14.09.2017 / 08:48
source