All posts by Arunima Menon

Overloading in C…..? ..Its possible…..

hi everyone..

since we started studying C language, we have been taught that method overloading is not possible in C..like everyone, even I believed that..
But yesterday I learnt that it is possible..by including a header file named STDARG.H.

This header file lets you create variadic functions.i.e. functions with variable arguments.
To perform method overloading, you just have to include this header file and declare a function which you intent to “overload” or provide variable inputs.

syntax:-
return type function-name( datatype1 arg1, datatype2 arg2,…);

Note:- the last 3 dots in the list(…), this is the one which tells the compiler that it would be taking variable arguments. It is mandatory to include these 3 dots(…) else your function would not accept variable inputs.

You can make a function which accepts same typed arguments or different.

The procedure to be followed is as follows:
1. you need to declare a variable “va_list” for iterating through the variable list.
2. then use macros like “va_start” – to start iterating through the variable list va_list.This macro takes two arguments. First the variable with type va_list and second is the name of the last argument given in the list. In the syntax given above , it would be arg2.
3. va_arg- to retrieve an argument from the list. In this macro you need to provide two arguments. First bariable of type va_list and second is the datatype of the next argument to be fetched.
4. finally, va_end macro- to find the end to the variable list.

Its really fun to work with this feature of C and perform a function which was said not to be possible in C.

This was just a jist about the header file and its macros.

Happy C Programming..!!!

My triumph over MYSQL..!

My fight with MySQL has finally come to an end. It has been troubling me past few weeks.
I was facing troubles on installing it on my office PC. Finally I got it right..!!!! hurrayyy..I won over it..!

The error which was troubling was ” Error No:1045- Access denied for user ‘root@localhost’ (using password:YES)”.

the resolution is:
MySQL configuration wizard doesn’t set or reset the root password. It simply leaves the password as blank. Otherwise the installation is complete.

The crack is: On getting this error, go to MySQL Command Line. Press ENTER when it asks for password(because it has been left blank by the Server Configuration Wizard).
On the command prompt, type SET PASSWORD FOR ‘root@localhost’ = PASSWORD(‘newpwd’);

Now its running….