Special C Programs



Dear learners,

Following is the list of special C programs. These are programs where some special function or logic is used.


Program related to Security



Observe the following interesting C program.



Printing formatted output using ASCII value.

#include<stdio.h>
int main()
{
  int i;

  for(i=0; i<10; i++)
            printf("%c",174);
  printf(" HELLO STUDENTS ");
  for(i=0; i<10; i++)
            printf("%c",175);
           
  printf("\n\n");
           
  for(i=0; i<10; i++)
            printf("%c",176);
  printf(" HELLO STUDENTS ");
  for(i=0; i<10; i++)
            printf("%c",176);
           
  printf("\n\n");
           
  for(i=0; i<10; i++)
            printf("%c",257);
  printf(" HELLO STUDENTS ");
  for(i=0; i<10; i++)
            printf("%c",258);
  return 0;          
}

Output of the Program:




C program to print memory occupied by int, float and char variables.

#include<stdio.h>

int main()
{
  int i;
  float f;
  char ch;

  printf("Size of int variable: %d \n",sizeof(i));
  printf("Size of float variable: %d \n",sizeof(f));
  printf("Size of char variable: %d \n",sizeof(ch));
  return 0;
}

Output of the Program:

Size of int variable: 4
Size of float variable: 4
Size of char variable: 1

Note: Output of the program may be different on your computer...




C program to use Arrow keys.

#include<stdio.h>
int   main() 
 int chr1, chr2; 
 printf("Press any arrow key...\n"); 
 chr1 = getch(); 
 if (chr1 == 0xE0) //to check scroll key interrupt
 { 
  chr2 = getch();  //to read arrow key
  switch(chr2) 
  { 
   case 72: printf("UP ARROW KEY PRESSED\n"); 
            break; 
   case 80: printf("DOWN ARROW KEY PRESSED\n"); 
            break; 
   case 75: printf("LEFT ARROW KEY PRESSED\n"); 
            break; 
   case 77: printf("RIGHT ARROW KEY PRESSED\n"); 
            break;
   default: printf("OTHER KEY PRESSED: %d %d\n", chr1, chr2);   
            break; 
  }; 
 } 
 return 0;
}

Output of the Program:

Press any arrow key...
UP ARROW KEY PRESSED



35 comments:

  1. Good collection of special C programs.

    ReplyDelete
  2. Replies
    1. Enjoy the power of self learning...Jeetendra...

      Delete
  3. nice programs very useful for reference

    ReplyDelete
  4. Nice Programs Sirrr....Good For reference

    ReplyDelete
    Replies
    1. Good...keep exploring this site for more interesting C language programs

      Delete
  5. Nice blog for self-learning...

    ReplyDelete
  6. Great special C Programs....Do post more programs related to graphics..

    ReplyDelete
  7. It is really useful for preparation...

    ReplyDelete
  8. Awesome blog for c programming.........
    It is Really help for Developing my logic Rearing programming languages
    Please put some mini projects regarding this...

    Thank You Sir

    ReplyDelete
  9. for c programming interview questions click here https://youtu.be/Uu8AcuJF5FE

    ReplyDelete
  10. Hey, very cool stuffs, How simply you have done such a huge things it is very interesting and nice.
    Please view this site also
    https://aakrist.me/index.php/2016/12/26/c-program-to-print-map-of-nation/

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete
  12. The blog is very informative.Thanks for sharing.If you want to reach good training institute & provide 100% placement Assistant.........more details......... Android Training in Chennai
    Selenium Training in Chennai
    Dot Net Training in Chennai

    ReplyDelete
  13. wow really superb you had posted one nice information through this. Definitely it will be useful for many people. So please keep update like this.

    MSBI Training in Chennai

    Software Testing Training in Chennai

    ReplyDelete
  14. Really it was an awesome article...very interesting to read..You have provided an nice article....Thanks for sharing..
    Android Training in Chennai
    Ios Training in Chennai

    ReplyDelete
  15. Thanks a lot for sharing this with all of us, I like it and we can communicate. Do you need buy app ratings and reviews. To boost app ranking and double app downloads now.

    ReplyDelete
  16. I have read your blog its very attractive and impressive. I like it your blog.
    Abinitio Online Training
    Hadoop Online Training
    Cognos Online Training

    ReplyDelete
  17. You've made some good points there. I looked on the internet for more information about this


    Mainframe Training In Chennai | Informatica Training In Chennai | Hadoop Training In Chennai

    ReplyDelete
  18. Hello,

    I went through your website and would like to suggest you to link up with

    one of the best Gujarati news paper Navgujarat Samay for updated news about Gujarat and India in Gujarati language.

    ReplyDelete
  19. Really very informative and creative contents. This concept is a good way to enhance the knowledge.
    thanks for sharing. please keep it up.
    Linux Training in Noida

    ReplyDelete
  20. Very Informative article you have described everything in a brilliant way. This is really useful arrticle for begginer learner. Appreciated!

    buffalo web design service is available in a proper way. You can develop your website in reasonable from Crystal Tech Solution.

    ReplyDelete
  21. Hiii....Thanks for sharing Great information...Nice post...Keep move on....
    Blockchain Training in Hyderabad

    ReplyDelete