Sunday, 21 October 2012

Printf in C

"printf" is the common output statement used in C programming...
and printf is also a function as you may know and it returns an integer value. But we may or may not collect the return value.
It returns the number of characters to be printed..
int n;
n=printf("Hello World!");
n has got a value 12
It returns 0 if it does not print anything
if(printf(""))  // is a false condition
if(printf("HELLO")) // is a true condition
try this code..
main()
{
printf(5+"Good Morning");
}
The output is : Morning

And same is the case in scanf

Ellipsis in C

# in C is a pre processor directive..It signifies compiler action, not associated with code generation
## is used to concatinate the numbers

Ex: 3##4 gives an output 34

Ellipsis in c (...): It is used in formal argument lists of function prototypes to indicate
variable number of arguments or arguments with varying types
    void fun(int n,char ch,...)
This declaration indicates that fun will be defined in such a way that calls must have
atleast two arguments, an int and a char, but can also have any number of additional
arguments.
In c++ you can omit the comma(,) preceding the ellipsis
The point to be noted is printf works, even though we are able to pass a number of arguments to it. If we design a function which takes two arguments and pass three parameters, we would definitely get the error “too many arguments to function”

    fun(int a, int b)

    fun(2,3,4) is not possible
If printf or scanf has got variable no.of  arguments...!
The prototype of printf is
    int printf(const char *str,...)

Sunday, 14 October 2012

Alternate Office tools

Found some cool opensource alternatives for MSOffice










 This Apache Open Office contain six tools to work with.

Writer : wordprocessor

Calc : spread sheets

Draw : image application

Base : Database tool

Math to create Mathematical equations through GUI

Impress : for multimedia presentations










Libre Office have the same six tools as if in Apache Open Office.












The tools of NeoOffice are also similar to Apache Open Office

NeoOffice is  for the applications for Mac OS X

















KOffice has three main tools as an alternative for Micrsoft office

KWord : Word Processing

KCells : Spread Sheet tool

Showcase : Presentation tool


Note : All these are Opensource tools ( a reference )