What is the difference between char a[] = "string"; and
char *p = "string"; ?

Answer Posted / karuna

a[] is a constant pointer to a string;

char *p is a pointer to a constant string;

In a[] address of a[] cant be change but string can be
change.

In char *p address can be change string cant be change

Is This Answer Correct ?    15 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does emoji p mean?

794


Suppose we have a table name EMP as below. We want to perform a operation in which, I want to change name ‘SMITH’ from as ‘SMITH JAIN’. Also I want to change the name of the column from ENAME to E_NAME. EMPNO ENAME JOB MGR HIREDATE SAL 7369 SMITH Coder 7902 17-DEC-80 800 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 7521 WARD SALESMAN 7698 22-FEB-81 1250

1744


FILE *fp1,*fp2; fp1=fopen("one","w") fp2=fopen("one","w") fputc('A',fp1) fputc('B',fp2) fclose(fp1) fclose(fp2)} a.error b. c. d.

1529


What is the use of a static variable in c?

793


Why C language is a procedural language?

803


Where are the auto variables stored?

855


find out largest elemant of diagonalmatrix

1880


Compare interpreters and compilers.

823


What is meant by operator precedence?

881


What is a char c?

803


What is the use of gets and puts?

774


Do pointers take up memory?

854


What are categories used for in c?

809


What are the __date__ and __time__ preprocessor commands?

782


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

839