-1
I’m doing a lot of my college activities that should be done using C, I’m struggling because I’m used to using only C++, I was first using scanf but the visual studio did not compile indicating security errors, so I migrated to scanf_s, compiled, but when reading a string I get the following error:
Here’s the code:
struct Conta {
char *nome;
int numeroConta;
int kwConsumidos;
};
struct Conta conta;
printf("Insira o nome: \n");
scanf_s("%s", &conta.nome);
A piece of advice. In visual studio, when programming in C, prefer to use the compiler Clang (can be downloaded by the visual installer) than MVSC (the natural compiler of visual studio) because visual studio, for C, has a serious compatibility problem with the ISO standard rules. These module functions <stdio. h> ending in _s are not recognized by other compilers, so the code is not portable, in addition, MVSC does not have support for _Generic, makes confusion with noreturn, has no VLA..., in short, it is quite problematic to program C with it.
– user142154
@v.Santos I like to use llvm in my projects, but who will correct the activity will not want to do this
– Samuel Ives