C Programming - Pointers - Discussion
Discussion Forum : Pointers - General Questions (Q.No. 2)
2.
Can you combine the following two statements into one?
char *p;
p = (char*) malloc(100);
Discussion:
82 comments Page 2 of 9.
Rashmi said:
1 decade ago
Here malloc (100) give the address and then by char*malloc (100) we got the value that is placed on that address.
And now we assign that value to char p* by that we get a pointer of char type.
And now we assign that value to char p* by that we get a pointer of char type.
Madhureddy said:
1 decade ago
Kavyashree explanation was excellent.
Suma sahithi said:
1 decade ago
Thanks Mahesh and Kavyasri for the explanation.
Saran said:
1 decade ago
Here we have to allocate space for char.
Manish said:
1 decade ago
I didnt understand about pointer,how it is work in c.
What is the difference between pointer of c and c++.?
What is the difference between pointer of c and c++.?
Jadhi said:
1 decade ago
I want to know about malloc clearly.
Jeevanantham said:
1 decade ago
The malloc() function is a memory allocation type. It allocats memory in bytes and also return the pointer to allocated memory.
Minu kutty said:
1 decade ago
I need complete details about pointers and c++ is better than c or not.
Vinoth said:
1 decade ago
Good example given by arunpandian
Rajesh said:
1 decade ago
Thanks kavyashri and mahesh for good explanation.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers