error: expected ';', ',' or ')' before '.' token? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!What does this error mean: “error: expected specifier-qualifier-list before 'type_name'”?expected ')' before '*' token with function pointer“expected specifier-qualifier-list before ‘*’ token” error in variadic functionFunction not working unless called in same fileerror: expected ‘;’, ‘,’ or ‘)’ before ‘.’ tokenerror: expected expression before '' token’ or ‘__attribute__’ before ‘=’ token

Israeli soda type drink

Split coins into combinations of different denominations

Second order approximation of the loss function (Deep learning book, 7.33)

Additive group of local rings

Is Diceware more secure than a long passphrase?

c++ diamond problem - How to call base method only once

How to keep bees out of canned beverages?

The art of proof summarizing. Are there known rules, or is it a purely common sense matter?

"My boss was furious with me and I have been fired" vs. "My boss was furious with me and I was fired"

Does the set of sets which are elements of every set exist?

"Rubric" as meaning "signature" or "personal mark" -- is this accepted usage?

I preordered a game on my Xbox while on the home screen of my friend's account. Which of us owns the game?

What *exactly* is electrical current, voltage, and resistance?

std::is_constructible on incomplete types

Identify story/novel: Tribe on colonized planet, not aware of this. "Taboo," altitude sickness, robot guardian (60s? Young Adult?)

Do I need to protect SFP ports and optics from dust/contaminants? If so, how?

Arriving in Atlanta after US Preclearance in Dublin. Will I go through TSA security in Atlanta to transfer to a connecting flight?

Map material from china not allowed to leave the country

How long after the last departure shall the airport stay open for an emergency return?

What if Force was not Mass times Acceleration?

As an international instructor, should I openly talk about my accent?

What is the term for a person whose job is to place products on shelves in stores?

Co-worker works way more than he should

What was Apollo 13's "Little Jolt" after MECO?



error: expected ';', ',' or ')' before '.' token?



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!What does this error mean: “error: expected specifier-qualifier-list before 'type_name'”?expected ')' before '*' token with function pointer“expected specifier-qualifier-list before ‘*’ token” error in variadic functionFunction not working unless called in same fileerror: expected ‘;’, ‘,’ or ‘)’ before ‘.’ tokenerror: expected expression before '' token’ or ‘__attribute__’ before ‘=’ token



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








-1















I'm writing a program in C with structs and pointers etc.
However, when I run it, it gives this error: "error: expected ';', ',' or ')' before '.' token"



at the following line



char *strcpy(char *account[i].nome, const char *nomi[p]);


Basically what I wanna do is, assing a random name taken from char nomi[p] where p is a random index between 0 and 4 into account.nome[i] variable where [i] is decleared in the for loop.



As you can see I commented this line



//account[i].nome = nomi[p];


Otherwise it would have gave me this error -> error: assignment to expression with array type



Any hints?



#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h> // includo la libreria per gestire le funzioni sui caratteri

#define MAX_ACCOUNT 5
#define MAX_NOME 20
#define MAX_COGNOME 20
#define MAX_EMAIL 40

typedef struct
int giorno;
int mese;
int anno;
data;

typedef struct
char nome[MAX_NOME];
char cognome[MAX_COGNOME];
data datadinascita;
char email[MAX_EMAIL];
char password;
acc;

int main(void)

int seed = time(NULL); // Randomizzo
srand(seed); // time
unsigned i = 0;
unsigned p = 0;
unsigned q = 0;
unsigned r = 0;
char* nomi[4] = "Gianmarco","Francesco","Michele","Marco","Roberto";
char* cognomi[4] = "Lorusso","Simone","Caggiano","Moramarco","Colonna";
char* email[4] = "rymmysice-2084@gmail.com","junetome-4060@hotmail.com","ikijaza-9272@live.it","hokalife-2155@libero.it","ottejotto-2395@gmail.com";

acc account[MAX_ACCOUNT] = 0;
data datadinascita[MAX_ACCOUNT]; //variabile datadinascita


//Ciclo di lettura
for(i = 0; i < MAX_ACCOUNT; i++)

p = rand() % (4-0+1) + 0; //Max 4, Min 0
q = rand() % (4-0+1) + 0; //Max 4, Min 0
r = rand() % (4-0+1) + 0; //Max 4, Min 0

char *strcpy(char *account[i].nome, const char *nomi[p]);
//account[i].nome = nomi[p];
//account[i].cognome = *cognomi[q];
datadinascita[i].giorno = rand() % (31-1+1) + 1; //Max 31, Min 1
datadinascita[i].mese = rand() % (12-1+1) + 1; //Max 12, Min 1
datadinascita[i].anno = rand() % (2003-1960+1) + 1960; //Max 2003, Min 1960
//account[i].email = *email[r];

printf("ACCOUNT #%d: ", i+1);
printf("Prova");
printf("ntNome: %19s", account[i].nome);
printf("ntCognome: %19s", account[i].cognome);
printf("ntData di nascita: %d-%d-%d", datadinascita[i].giorno, datadinascita[i].mese, datadinascita[i].anno);
printf("ntEmail: %39s", account[i].email);
printf("n");



return 0;










share|improve this question



















  • 5





    char *strcpy(char *account[i].nome, const char *nomi[p]); is not a function call.

    – Eugene Sh.
    Mar 22 at 15:51






  • 1





    Change char *strcpy(char *account[i].nome, const char *nomi[p]); to strcpy(account[i].nome, nomi[p]); and add #include <stdlib.h> and #include <time.h>. You are also trying to provide 5 initialisers to your 4-element arrays.

    – Weather Vane
    Mar 22 at 15:56


















-1















I'm writing a program in C with structs and pointers etc.
However, when I run it, it gives this error: "error: expected ';', ',' or ')' before '.' token"



at the following line



char *strcpy(char *account[i].nome, const char *nomi[p]);


Basically what I wanna do is, assing a random name taken from char nomi[p] where p is a random index between 0 and 4 into account.nome[i] variable where [i] is decleared in the for loop.



As you can see I commented this line



//account[i].nome = nomi[p];


Otherwise it would have gave me this error -> error: assignment to expression with array type



Any hints?



#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h> // includo la libreria per gestire le funzioni sui caratteri

#define MAX_ACCOUNT 5
#define MAX_NOME 20
#define MAX_COGNOME 20
#define MAX_EMAIL 40

typedef struct
int giorno;
int mese;
int anno;
data;

typedef struct
char nome[MAX_NOME];
char cognome[MAX_COGNOME];
data datadinascita;
char email[MAX_EMAIL];
char password;
acc;

int main(void)

int seed = time(NULL); // Randomizzo
srand(seed); // time
unsigned i = 0;
unsigned p = 0;
unsigned q = 0;
unsigned r = 0;
char* nomi[4] = "Gianmarco","Francesco","Michele","Marco","Roberto";
char* cognomi[4] = "Lorusso","Simone","Caggiano","Moramarco","Colonna";
char* email[4] = "rymmysice-2084@gmail.com","junetome-4060@hotmail.com","ikijaza-9272@live.it","hokalife-2155@libero.it","ottejotto-2395@gmail.com";

acc account[MAX_ACCOUNT] = 0;
data datadinascita[MAX_ACCOUNT]; //variabile datadinascita


//Ciclo di lettura
for(i = 0; i < MAX_ACCOUNT; i++)

p = rand() % (4-0+1) + 0; //Max 4, Min 0
q = rand() % (4-0+1) + 0; //Max 4, Min 0
r = rand() % (4-0+1) + 0; //Max 4, Min 0

char *strcpy(char *account[i].nome, const char *nomi[p]);
//account[i].nome = nomi[p];
//account[i].cognome = *cognomi[q];
datadinascita[i].giorno = rand() % (31-1+1) + 1; //Max 31, Min 1
datadinascita[i].mese = rand() % (12-1+1) + 1; //Max 12, Min 1
datadinascita[i].anno = rand() % (2003-1960+1) + 1960; //Max 2003, Min 1960
//account[i].email = *email[r];

printf("ACCOUNT #%d: ", i+1);
printf("Prova");
printf("ntNome: %19s", account[i].nome);
printf("ntCognome: %19s", account[i].cognome);
printf("ntData di nascita: %d-%d-%d", datadinascita[i].giorno, datadinascita[i].mese, datadinascita[i].anno);
printf("ntEmail: %39s", account[i].email);
printf("n");



return 0;










share|improve this question



















  • 5





    char *strcpy(char *account[i].nome, const char *nomi[p]); is not a function call.

    – Eugene Sh.
    Mar 22 at 15:51






  • 1





    Change char *strcpy(char *account[i].nome, const char *nomi[p]); to strcpy(account[i].nome, nomi[p]); and add #include <stdlib.h> and #include <time.h>. You are also trying to provide 5 initialisers to your 4-element arrays.

    – Weather Vane
    Mar 22 at 15:56














-1












-1








-1








I'm writing a program in C with structs and pointers etc.
However, when I run it, it gives this error: "error: expected ';', ',' or ')' before '.' token"



at the following line



char *strcpy(char *account[i].nome, const char *nomi[p]);


Basically what I wanna do is, assing a random name taken from char nomi[p] where p is a random index between 0 and 4 into account.nome[i] variable where [i] is decleared in the for loop.



As you can see I commented this line



//account[i].nome = nomi[p];


Otherwise it would have gave me this error -> error: assignment to expression with array type



Any hints?



#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h> // includo la libreria per gestire le funzioni sui caratteri

#define MAX_ACCOUNT 5
#define MAX_NOME 20
#define MAX_COGNOME 20
#define MAX_EMAIL 40

typedef struct
int giorno;
int mese;
int anno;
data;

typedef struct
char nome[MAX_NOME];
char cognome[MAX_COGNOME];
data datadinascita;
char email[MAX_EMAIL];
char password;
acc;

int main(void)

int seed = time(NULL); // Randomizzo
srand(seed); // time
unsigned i = 0;
unsigned p = 0;
unsigned q = 0;
unsigned r = 0;
char* nomi[4] = "Gianmarco","Francesco","Michele","Marco","Roberto";
char* cognomi[4] = "Lorusso","Simone","Caggiano","Moramarco","Colonna";
char* email[4] = "rymmysice-2084@gmail.com","junetome-4060@hotmail.com","ikijaza-9272@live.it","hokalife-2155@libero.it","ottejotto-2395@gmail.com";

acc account[MAX_ACCOUNT] = 0;
data datadinascita[MAX_ACCOUNT]; //variabile datadinascita


//Ciclo di lettura
for(i = 0; i < MAX_ACCOUNT; i++)

p = rand() % (4-0+1) + 0; //Max 4, Min 0
q = rand() % (4-0+1) + 0; //Max 4, Min 0
r = rand() % (4-0+1) + 0; //Max 4, Min 0

char *strcpy(char *account[i].nome, const char *nomi[p]);
//account[i].nome = nomi[p];
//account[i].cognome = *cognomi[q];
datadinascita[i].giorno = rand() % (31-1+1) + 1; //Max 31, Min 1
datadinascita[i].mese = rand() % (12-1+1) + 1; //Max 12, Min 1
datadinascita[i].anno = rand() % (2003-1960+1) + 1960; //Max 2003, Min 1960
//account[i].email = *email[r];

printf("ACCOUNT #%d: ", i+1);
printf("Prova");
printf("ntNome: %19s", account[i].nome);
printf("ntCognome: %19s", account[i].cognome);
printf("ntData di nascita: %d-%d-%d", datadinascita[i].giorno, datadinascita[i].mese, datadinascita[i].anno);
printf("ntEmail: %39s", account[i].email);
printf("n");



return 0;










share|improve this question
















I'm writing a program in C with structs and pointers etc.
However, when I run it, it gives this error: "error: expected ';', ',' or ')' before '.' token"



at the following line



char *strcpy(char *account[i].nome, const char *nomi[p]);


Basically what I wanna do is, assing a random name taken from char nomi[p] where p is a random index between 0 and 4 into account.nome[i] variable where [i] is decleared in the for loop.



As you can see I commented this line



//account[i].nome = nomi[p];


Otherwise it would have gave me this error -> error: assignment to expression with array type



Any hints?



#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h> // includo la libreria per gestire le funzioni sui caratteri

#define MAX_ACCOUNT 5
#define MAX_NOME 20
#define MAX_COGNOME 20
#define MAX_EMAIL 40

typedef struct
int giorno;
int mese;
int anno;
data;

typedef struct
char nome[MAX_NOME];
char cognome[MAX_COGNOME];
data datadinascita;
char email[MAX_EMAIL];
char password;
acc;

int main(void)

int seed = time(NULL); // Randomizzo
srand(seed); // time
unsigned i = 0;
unsigned p = 0;
unsigned q = 0;
unsigned r = 0;
char* nomi[4] = "Gianmarco","Francesco","Michele","Marco","Roberto";
char* cognomi[4] = "Lorusso","Simone","Caggiano","Moramarco","Colonna";
char* email[4] = "rymmysice-2084@gmail.com","junetome-4060@hotmail.com","ikijaza-9272@live.it","hokalife-2155@libero.it","ottejotto-2395@gmail.com";

acc account[MAX_ACCOUNT] = 0;
data datadinascita[MAX_ACCOUNT]; //variabile datadinascita


//Ciclo di lettura
for(i = 0; i < MAX_ACCOUNT; i++)

p = rand() % (4-0+1) + 0; //Max 4, Min 0
q = rand() % (4-0+1) + 0; //Max 4, Min 0
r = rand() % (4-0+1) + 0; //Max 4, Min 0

char *strcpy(char *account[i].nome, const char *nomi[p]);
//account[i].nome = nomi[p];
//account[i].cognome = *cognomi[q];
datadinascita[i].giorno = rand() % (31-1+1) + 1; //Max 31, Min 1
datadinascita[i].mese = rand() % (12-1+1) + 1; //Max 12, Min 1
datadinascita[i].anno = rand() % (2003-1960+1) + 1960; //Max 2003, Min 1960
//account[i].email = *email[r];

printf("ACCOUNT #%d: ", i+1);
printf("Prova");
printf("ntNome: %19s", account[i].nome);
printf("ntCognome: %19s", account[i].cognome);
printf("ntData di nascita: %d-%d-%d", datadinascita[i].giorno, datadinascita[i].mese, datadinascita[i].anno);
printf("ntEmail: %39s", account[i].email);
printf("n");



return 0;







c pointers struct






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 22 at 15:52









Some programmer dude

306k25266429




306k25266429










asked Mar 22 at 15:49









SlimShadysSlimShadys

1812




1812







  • 5





    char *strcpy(char *account[i].nome, const char *nomi[p]); is not a function call.

    – Eugene Sh.
    Mar 22 at 15:51






  • 1





    Change char *strcpy(char *account[i].nome, const char *nomi[p]); to strcpy(account[i].nome, nomi[p]); and add #include <stdlib.h> and #include <time.h>. You are also trying to provide 5 initialisers to your 4-element arrays.

    – Weather Vane
    Mar 22 at 15:56













  • 5





    char *strcpy(char *account[i].nome, const char *nomi[p]); is not a function call.

    – Eugene Sh.
    Mar 22 at 15:51






  • 1





    Change char *strcpy(char *account[i].nome, const char *nomi[p]); to strcpy(account[i].nome, nomi[p]); and add #include <stdlib.h> and #include <time.h>. You are also trying to provide 5 initialisers to your 4-element arrays.

    – Weather Vane
    Mar 22 at 15:56








5




5





char *strcpy(char *account[i].nome, const char *nomi[p]); is not a function call.

– Eugene Sh.
Mar 22 at 15:51





char *strcpy(char *account[i].nome, const char *nomi[p]); is not a function call.

– Eugene Sh.
Mar 22 at 15:51




1




1





Change char *strcpy(char *account[i].nome, const char *nomi[p]); to strcpy(account[i].nome, nomi[p]); and add #include <stdlib.h> and #include <time.h>. You are also trying to provide 5 initialisers to your 4-element arrays.

– Weather Vane
Mar 22 at 15:56






Change char *strcpy(char *account[i].nome, const char *nomi[p]); to strcpy(account[i].nome, nomi[p]); and add #include <stdlib.h> and #include <time.h>. You are also trying to provide 5 initialisers to your 4-element arrays.

– Weather Vane
Mar 22 at 15:56













1 Answer
1






active

oldest

votes


















0














Should be something like



strcpy(account[i].nome, nomi[p]);





share|improve this answer























  • This and the reply from @Weather Vane perfectly worked.

    – SlimShadys
    Mar 22 at 15:59












  • @SlimShadys Now the big question for you: Do you understand why? And I'm curious, where did the previous line come from? Was it a copy-paste that you didn't modify correctly?

    – Some programmer dude
    Mar 22 at 20:18











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55303354%2ferror-expected-or-before-token%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Should be something like



strcpy(account[i].nome, nomi[p]);





share|improve this answer























  • This and the reply from @Weather Vane perfectly worked.

    – SlimShadys
    Mar 22 at 15:59












  • @SlimShadys Now the big question for you: Do you understand why? And I'm curious, where did the previous line come from? Was it a copy-paste that you didn't modify correctly?

    – Some programmer dude
    Mar 22 at 20:18















0














Should be something like



strcpy(account[i].nome, nomi[p]);





share|improve this answer























  • This and the reply from @Weather Vane perfectly worked.

    – SlimShadys
    Mar 22 at 15:59












  • @SlimShadys Now the big question for you: Do you understand why? And I'm curious, where did the previous line come from? Was it a copy-paste that you didn't modify correctly?

    – Some programmer dude
    Mar 22 at 20:18













0












0








0







Should be something like



strcpy(account[i].nome, nomi[p]);





share|improve this answer













Should be something like



strcpy(account[i].nome, nomi[p]);






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 22 at 15:55









Mikhail VladimirovMikhail Vladimirov

11.4k12631




11.4k12631












  • This and the reply from @Weather Vane perfectly worked.

    – SlimShadys
    Mar 22 at 15:59












  • @SlimShadys Now the big question for you: Do you understand why? And I'm curious, where did the previous line come from? Was it a copy-paste that you didn't modify correctly?

    – Some programmer dude
    Mar 22 at 20:18

















  • This and the reply from @Weather Vane perfectly worked.

    – SlimShadys
    Mar 22 at 15:59












  • @SlimShadys Now the big question for you: Do you understand why? And I'm curious, where did the previous line come from? Was it a copy-paste that you didn't modify correctly?

    – Some programmer dude
    Mar 22 at 20:18
















This and the reply from @Weather Vane perfectly worked.

– SlimShadys
Mar 22 at 15:59






This and the reply from @Weather Vane perfectly worked.

– SlimShadys
Mar 22 at 15:59














@SlimShadys Now the big question for you: Do you understand why? And I'm curious, where did the previous line come from? Was it a copy-paste that you didn't modify correctly?

– Some programmer dude
Mar 22 at 20:18





@SlimShadys Now the big question for you: Do you understand why? And I'm curious, where did the previous line come from? Was it a copy-paste that you didn't modify correctly?

– Some programmer dude
Mar 22 at 20:18



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55303354%2ferror-expected-or-before-token%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해