这个错误意味着什么?
request for member '*******' in something not a structure or union
Run Code Online (Sandbox Code Playgroud)
在我学习C的时候,我已经好几次遇到过它,但我还没有弄清楚它意味着什么.
我在这条线上遇到了问题 c->next=var;
我的职责是:
{
struct film
{
int id;
char nom[50];
char typeFilm[50];
int duree;
int dateSortie;
struct film *next;
};
#include<stdio.h>
#include<string.h>
#include "structure_film.h"
#include<stdlib.h>
void ajouter_film(struct film **h,struct film **c)
{
struct film *var;
int s, genre;
do
{
var=(struct film*) malloc(sizeof(struct film));
printf("quel est le nom du film que vous voulez ajouter ? \n");
scanf("%s",var->nom);
printf("\nquel est le type de ce film \n 1-action \n 2-aventure \n 3-romantique \n 4-comedie \n");
scanf("%d",&genre);
switch(genre)
{
case 1 : …Run Code Online (Sandbox Code Playgroud) 我有一个unsigned char指针,其中包含一个结构.现在我想要执行以下操作
unsigned char *buffer ;
//code to fill the buffer with the relavent information.
int len = ntohs((record_t*)buffer->len);
Run Code Online (Sandbox Code Playgroud)
其中record_t结构包含一个名为len的字段.我无法这样做并且收到错误.
error: request for member ‘len’ in something not a structure or union.
Run Code Online (Sandbox Code Playgroud)
我在这做错了什么?