This error occurs because you use a string (text) and used only one char (character). In C language a string is represented by a character vector ending with a null character '\ 0'. But you just put char nick . The correct would be char nick ;
When declaring char the compiler will allocate only 1byte of memory capable of storing a character.
Howeverafterputtingthischar[100]youwillgetanothererror,checkout:
Thatis,itisnotpossibletoassignastringfieldofastructtoaconstantstring"Assanges".
To work you must use the function of (string copy) or
strcpy (destination, source).
So put: strcpy (user.nick, "Assanges"); and it will work!
Remember to include string.h
Check out:
Seebelowthecorrectcode
#include<stdio.h>#include<stdlib.h>#include<string.h>structUser{charnick[100];intid;}user;intmain(){strcpy(user.nick,"Assanges");
user.id = 45474;
printf("\nNick:%s\nId:%d \n", user.nick, user.id);
return 0;
}
Now when running it will work!