0
This error occurs because, you want to use a string(text) and only used a char(character). In the C language a string is represented by a string ending with a null character ' 0'. But you put only as char nick. The correct would be for example char nick[100];
When declaring char the compiler will allocate only 1byte of memory capable of storing a character.
However after placing this char[100] you will receive another error, check out:
That is, it is not possible to assign a string field of a struct to a string constant "Assanges". To work you must use the function of (string copy) or strcpy(destination, origin). So put: strcpy(user.nick, "Assanges"); and it will work!
Remember to make string include. h
Check out:
See below the correct code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct User{
char nick[100];
int id;
}user;
int main(){
strcpy(user.nick, "Assanges");
user.id = 45474;
printf("\nNick:%s\nId:%d \n", user.nick, user.id);
return 0;
}
Now when performing it will work!
Post code and output, not images
– Denis Rudnei de Souza