simple problem with Vector and Structs


Hi, I'd like to know why you're not going, I've searched a lot of places but I can't find it

in C

#include <stdio.h>
typedef struct ficha_pessoal{
    int idade;
    char sexo;
    int CPF [11];
    int CPFc [3];
    float salario;
    char nome [40];
int main(){
    FICHA x;
    x.sexo = 'M';
    x.nome[40]= "JOSE DA SILVA";
    x.salario =850;
    x.CPF[1] = {5,3,1,9,8,7,0,0,,1,4,1};
return 0;

say that in error

||In function 'main':| |18|warning: assignment makes integer from pointer without a cast [enabled by default]| |20|error: expected expression before '{' token| ||=== Build failed: 1 error(s), 1 warning(s) (0 minute(s), 0 second(s)) ===|


As you are doing the assignment, it is only possible in the variable declaration. (or if you make a function for it).

The first mistake is because you can't assign a value that way in the C language.

The second error is a syntax error, showing that '{}'(braces) does not exist in the assignment of such a type (integer).

Hope this helps.

Take a closer look at this link here:

Hugs and good studies!

Scroll to Top