How do I define an element of a Struct in C?

Asked

Viewed 40 times

1

I intend to make a program that uses structs to store data, but that there is already some data inserted in it, I will give a similar example:

struct registro
{
    char nome[30], telefone[11];
    int idade
}dados;

In case I needed to do something like:

dados[2].nome="José";

So that the program has a base on it, being able to insert new data or search for existing data, however I could not find anything on the internet that explains how to do this and I also could not find any solution. Anyone can help?

1 answer

1


I managed to solve my problem, in case I used a library command

strcpy(dados[1].nome, "José");

Browser other questions tagged

You are not signed in. Login or sign up in order to post.