aditya.bokaro
BAN USERchar *myStrcat(char *s, const char *t)
{
char *p = s;
if (s == NULL || t == NULL)
return s; /* we need not have to do anything */
while (*s)
s++;
while (*s++ = *t++)
;
return p;
}
void anagram(char *d, char *c, int length)
{
int i=0;
while(length--)
{d[i]=c[length];
i++;}
d[i]='\0';
}
#define getsize(x) ((char *)(&(x) + 1) - (char *)&(x))
int i; getsize(i);
char *strcpy(char *dest, const char *src){
char *save = dest;
while(*dest++ = *src++);
return save;}
Structure padding is adding extra bits at the end of the structue,so that the structure completes the word boundary. Structure padding is used to pad the data in such a way that it can be sent to external devices. Sometimes, the data is padded in such a way that it can be used on little endian vs big endian processors .
When you call malloc(), you specify the amount of memory to allocate. The amount of memory actually used is slightly more than this, and includes extra information that records (at least) how big the block is. You can't (reliably) access that other information - and nor should you :-).
When you call free(), it simply looks at the extra information to find out how big the block is.
typically this is stored at the end of the block but is highly machine dependent as in some machines this is mapped at some other location.
int sprintf ( char * buffer, const char * format [ , argument , ...] );
#define is handled by preprocessor, typedef by compiler
#define has no scope control
some things cannot be done by #define like intelligent declaration of pointers.
typedef int* int_p1;
int_p1 a, b, c; // a, b, and c are all int pointers.
#define int_p2 int*
int_p2 a, b, c; // only the first is a pointer!
there are 3 ways :
1. create a new doubly linked list and copy the values with reversing the prev and next pointers
2. swap values of last with first, second-last with second and so on
3. change the head from first to last node and reverse the prev next.
Logically it does not make much difference except the head but when asked for reversing we shud consider the pointers next and prev
They restrict the values that the enum variable can take.
They force you to think about all the possible values that the enum can take.
They are a constant rather than a number, increasing readability
substitute for #define in c and (const int) in c++
ohh!!!!
- aditya.bokaro October 07, 2011sorry i did the palindrome..
thanks
:)