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

Answer Posted / mak

in case of array size of it become fixed after initialization,
so a string of length greater than the size of previous string can't be assigned to array.
on the other hand pointer can take variable size string as it stores only the first address.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the term printf() and scanf() used in c language?

806


Difference between pass by reference and pass by value?

856


write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line.

2639


1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.

1901


hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm

1805


Explain how do you determine whether to use a stream function or a low-level function?

821


What is the difference between far and near in c?

783


write a program to generate address labels using structures?

4269


the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?

746


What are the ways to a null pointer can use in c programming language?

856


Explain why can’t constant values be used to define an array’s initial size?

1087


How to get string length of given string in c?

793


show how link list can be used to repersent the following polynomial i) 5x+2

1891


What is the difference between strcpy() and memcpy() function in c programming?

844


What is the correct code to have following output in c using nested for loop?

817