Posts

Showing posts from July, 2016

Find String length without using any built in function

#include
#include

void main() {
    clrscr();
    char s[] = "kartik butani";

    int cout = 0;
    char st;
    do {
        st = s[cout++];
    }while(st != '\0');

    printf("%d",--cout);
    getch();

}

Swapping program in one line

Swapping program in one line
#include
#include

void main() {
    clrscr();
    int a=36,b=20;

    a = (a+b) - (b = (a+b)-b);

    printf("%3d %3d",a,b);
    getch();
}