Which of the following are invalid array variable declaratio

Which of the following are invalid array variable declarations ?

char name[] = {J, e, n, n, i, f, e, r};

int flags[4] = {0, 0, 0};

char lastName = “Vasquez”;

int []scores;

double vals = {0.0, 1.0, -2.5};

char name[] = {J, e, n, n, i, f, e, r};

int flags[4] = {0, 0, 0};

char lastName = “Vasquez”;

int []scores;

double vals = {0.0, 1.0, -2.5};

Solution

Answer:

Below are the invalid array variable declarations in c programming..

char name[] = {J, e, n, n, i, f, e, r}; it shoudl be char name[] = {\'J\', \'e\', \'n\', \'n\', \'i\', \'f\', \'e\', \'r\'};

char lastName = “Vasquez”; this is not a valid char array declaration

double vals = {0.0, 1.0, -2.5} ; it should be double vals[] = {0.0, 1.0, -2.5} ;

int []scores; we have to specify the size like int scores[4];

Which of the following are invalid array variable declarations ? char name[] = {J, e, n, n, i, f, e, r}; int flags[4] = {0, 0, 0}; char lastName = “Vasquez”; in

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site