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

Answer Posted / ashok

Pointers are fine a cannot be changed p can be changed.

I have a doubt like is there any difference in memory
allocation.

I heard like a gets its memory in local stack and p gets in
data section.

I don get the clear explanation

Is This Answer Correct ?    3 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the functions to open and close the file in c language?

795


Where are some collections of useful code fragments and examples?

949


In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.

1608


Which is best linux os?

761


write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.

2210


write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?

1923


How can I manipulate individual bits?

793


Is c easier than java?

784


what do u mean by Direct access files? then can u explain about Direct Access Files?

1840


What is dangling pointer in c?

808


Explain modulus operator.

802


write a program to find out prime number using sieve case?

1854


Difference between Shallow copy and Deep copy?

1778


What is the difference between declaring a variable and defining a variable?

944


How to Throw some light on the splay trees?

798