Browsing all articles in sample programme
Jan
28

Why variables can not be declared in a switch statement just after labels?

see this code

#include<stdio.h>
int main()
{
   int i=1;
   switch(i)
   {
       case 1: int x=10;
               printf(" x is %d",x);
       break;
    }
    return 0;
}

Do you think this code will compile? if yes then you need to read this post….

read more

Jan
5

How can i detect Windows or Linux in C,C++ programming?

 

Sometimes we need to write platform independent  code which works in windows and linux machine without giving any flag or any modification in code or make file manually.

So in such case i usually use compiler generated macro to check the platform .

 

In Linux all c and c++ compiler define macro like  linux, In Windows all c and c++ compiler define macro like _WIN32 

so we can use this macro to separate code for linux and windows see belows example code

read more

Oct
31

Huffman Encoding Using Linked List with Source Code

Author saurabh    Category c, sample programme     Tags

After a long time, I am back. Months without programming and then finally I got some time on my hands. So I set out to code the Huffman’s Data Compression Algorithm. And the result is here!

The code is well-commented and I hav given some additional documentation. Also, I hav tested it extensively – right from small words to complete bollywood Songs..:P

Here i had did two types of Huffman Encoding

1 ) Simple User Input

2) Take Input from File

But if there are any probs,let me know.

read more

Follow us on Twitter! Follow us on Twitter!

Search in this website

our sponsors

latest comments

Find us on Facebook

Top Authors

35 posts
saurabh
22 posts
10 posts

Find us on stackoverflow

Polls

Tell us who you are

View Results

Loading ... Loading ...

My Bookmarks

Sponsers Link