what is the difference between 1 & 2?
1. pat = (PATTERN *)
vector(1,(int)*num_patfiles,sizeof(PATTERN));
2. pat = PATTERN * vector(1,(int)*num_patfiles,sizeof(PATTERN));
what is the difference between 1 & 2?
1. pat = (PATTERN *)
vector(1,(int)*num_patfiles,sizeof(PATTERN));
2. pat = PATTERN * vector(1,(int)*num_patfiles,sizeof(PATTERN));
look at it this way
vector(1,(int)*num_patfiles,sizeof(PATTERN));
this returns something. My guess is a pointer of some sort.
(PATTERN *)
this is a cast.So putting the 2 together you are casting the result of vector(blahblah) to a PATTERN* or a pointer to a PATTERN and storing that in the variable pat.
pat = PATTERN * vector(1,(int)*num_patfiles,sizeof(PATTERN));
This on the other hand is a multiplication. It shouldn't compile as pointers cant be multiplied. This says multiply PATTERN with the result of vector(blahblah) and store the result in pat.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi