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 9 of 9.
Parth lathiya said:
3 years ago
@Vij.
Both are not the same.
Because
1) not a proper variable pointer declaration.
So, 2) proper define the pointer variable.
Both are not the same.
Because
1) not a proper variable pointer declaration.
So, 2) proper define the pointer variable.
Himanshu Vishwakarma said:
2 years ago
1) The correct syntax to create a pointer of a specific type is:- <data type> *(pointer name);
2) malloc returns a "void" pointer to the allocated continuous memory size and it must be converted to the required type.
2) malloc returns a "void" pointer to the allocated continuous memory size and it must be converted to the required type.
(4)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers