what is the difference between these initializations?
Char a[]=”string”;
Char *p=”literal”;
Does *p++ increment p, or what it points to?

Answer Posted / bee

logically, both are treated as array of characters(i.e.
string) but....

1) a is an array of characters(a string)

2) p is a pointer to an array of characters
the statement char *p = "literal" is equivalent to
char j[] = "literal"
char *p = j;
3) *p++ can be seen as *(p++)....
this is so because '++' has higher recedence over '*'
operator. so, it increments address by 1 unit and prints
the corresponding value value

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the code for 3 questions and answer check in VisualBasic.Net?

1695


1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.

2338


Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..

647


Which built-in library function can be used to match a patter from the string?

747


In C language, a variable name cannot contain?

745






What is the general form of a C program?

600


what is the diffrenet bettwen HTTP and internet protocol

1394


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.

1481


we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above

638


Is boolean a datatype in c?

548


What is #include conio h?

597


What does void main return?

607


When a c file is executed there are many files that are automatically opened what are they files?

595


Where are some collections of useful code fragments and examples?

716


How many types of errors are there in c language? Explain

573