recategorized by
1,783 views
2 votes
2 votes

Which of the following is illegal declaration in $C$ language?

  1. char*str ="Raj is a Research scholar";
    
  2. char str[25] ="Raj is a Research scholar";
    
  3. char str[40] ="Raj is a Research scholar";
    
  4. char[]str ="Raj is a Research scholar";

     

recategorized by

2 Answers

2 votes
2 votes

Ans initialization  of variable in Option D not valid

Character array/ string initialization:
char variable_name[]= "India";   
OR
char variable_name[10]= "India"; 

option B,D let str[25} an char array and starting address of array is 1000

R a j   i s   a   r e a r c h   s c h o l a r /0 /0

in Option A  str is char pointer which pointing or store starting address of char array

str

1000

 

0 votes
0 votes
corect option is d

char[]str ="Raj is a Research scholar";it is not a valid declaration in c language .
Answer:

Related questions

4 votes
4 votes
4 answers
1
admin asked Mar 31, 2020
1,475 views
What is the meaning of following declaration?int(*p[7])();$p$ is pointer to function$p$ is pointer to such function which return type is array$p$ is array of pointer to f...
2 votes
2 votes
4 answers
2
2 votes
2 votes
2 answers
3
admin asked Mar 31, 2020
957 views
In binary search tree which traversal is used for getting ascending order values ?InorderPreorderPostorderNone of the options
2 votes
2 votes
4 answers
4
admin asked Mar 31, 2020
1,670 views
The automaton which allows transformation to a new state without consuming any input symbols : $NFA$$DFA$$NFA - 1$All of the options