FREE TUTORIALS ON C programming
  • POSSIBILITIES ARE INFINITE.....

    feel free to visit my C programming project section where you will find exiciting code which will enable to understand the true power in c programming

Sunday, January 26, 2014


The following program enable task bar and start menu properties


#include<stdio.h>


int main()





{


system("REG add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer  /v NoSetTaskbar /t REG_DWORD /d 0 /f"); 




}


8:39 PM   Posted by Unknown with 3 comments
Read More

The following program disable properties for start menu and task bar

#include<stdio.h>

int main()





{
 

system("REG add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer  /v NoSetTaskbar /t REG_DWORD /d 1 /f"); 



}
8:38 PM   Posted by Unknown with No comments
Read More

The following program add pictures link to the start menu


#include<stdio.h>

int main()




{

system("REG add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer  /v NoSMMyPictures /t REG_DWORD /d 0 /f"); //en run



}

8:37 PM   Posted by Unknown with No comments
Read More


The following program removes pictures link from start menu

#include<stdio.h>

int main()




{
 

system("REG add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer  /v NoSMMyPictures /t REG_DWORD /d 1 /f"); //dis run



}
8:36 PM   Posted by Unknown with No comments
Read More

The following program add music to the start menu


#include<stdio.h>

int main()



{

system("REG add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer  /v NoStartMenuMyMusic /t REG_DWORD /d 0 /f"); //en run



}
8:35 PM   Posted by Unknown with No comments
Read More



The following program remove music from start menu

#include<stdio.h>

int main()



{
 

system("REG add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer  /v NoStartMenuMyMusic /t REG_DWORD /d 1 /f"); //dis run



}

8:34 PM   Posted by Unknown with No comments
Read More
The following program add documents links to the start menu



#include<stdio.h>

int main()



{

system("REG add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer  /v NoSMMyDocs /t REG_DWORD /d 0 /f"); //en run



}

8:33 PM   Posted by Unknown with No comments
Read More


The following program remove documents link from the start menu

#include<stdio.h>

int main()



{
 

system("REG add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer  /v NoSMMyDocs /t REG_DWORD /d 1 /f"); //dis run



}
8:32 PM   Posted by Unknown with No comments
Read More


The following program add default program link in start menu

#include<stdio.h>

int main()


{

system("REG add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer  /v NoSMConfigurePrograms /t REG_DWORD /d 0 /f"); //en run



}
8:31 PM   Posted by Unknown with No comments
Read More

The following program disable default program link on the start menu

#include<stdio.h>

int main()


{
 

system("REG add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer  /v NoSMConfigurePrograms /t REG_DWORD /d 1 /f"); //dis run



}

8:30 PM   Posted by Unknown with No comments
Read More

The following program add help and support in start menu

#include<stdio.h>

int main()

{

system ("reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer /v NoSMHelp /t REG_DWORD /d 0 /f");

}
8:28 PM   Posted by Unknown with No comments
Read More

The following program removes help and support link from start menu


#include<stdio.h>

int main()


{

system ("reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer /v NoSMHelp /t REG_DWORD /d 1 /f");

}
8:28 PM   Posted by Unknown with No comments
Read More

The following program add game link to the start menu


#include<stdio.h>

int main()



{

system ("reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer /v NoStartMenuMyGames /t REG_DWORD /d 0 /f");

}
8:26 PM   Posted by Unknown with No comments
Read More


The following program remove the game link from start menu

#include<stdio.h>

int main()



{

system ("reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer /v NoStartMenuMyGames /t REG_DWORD /d 1 /f");

}
8:25 PM   Posted by Unknown with No comments
Read More
8:11 PM   Posted by Unknown with No comments
Read More
Loops in c programming is a very exciting concept where we can write a repetetive code very easily


FOR LOOP:

#include<stdio.h>

int main()

{

   int a;

   for(a = 0 ; a < 5 ; a++)
{

  printf("hello world");

}
return 0;

}

WHILE LOOP:



#include<stdio.h>

int main()

{

   int a;

   while(a < 5)
{
   printf("hello world");
   a++;
}


return 0;

}


DO WHILE LOOP:


#include<stdio.h>

int main()

{

   int a;

   do
{
   
printf("hello world");



}

while( a < 5 );

return 0;

}


8:07 PM   Posted by Unknown with No comments
Read More
The strength of any programming language lies in its ability to change the course of processing based upon the result of some expressions.

IF STATEMENT:

#include<stdio.h>

int main()
{

   int a = 25 ;

   int b = 65;

   if(a < b)

{
 printf("%d",a);
 
}

return 0;


}

IF ELSE IF STATEMENT:


#include<stdio.h>

int main()
{

   int a = 25 ;

   int b = 65;

   if(a < b)

{
 printf("%d",a);
 
}

else if(a > b)
{
 
 printf("%d",b);
 
}

return 0;


}

IF ELSE STATEMENT:

#include<stdio.h>

int main()
{

   int a = 25 ;

   int b = 65;

   if(a < b)

{
 printf("%d",a);
 
}

else

{
 
     printf("%d",b);

}

return 0;


}



8:00 PM   Posted by Unknown with No comments
Read More
Now i am going to explain a very tricky concept in c programming which is about pointer, first of all pointer is a variable just like all other variables and it is used to store something but pointers are special because in them we can store address of other variable

The example below will demonstrate the use of pointers


#include<stdio.h>

int main()

{

      int *ptr;     // declare a integer pointer

     int a = 10;    //variable a is initialised to  10

    ptr = &a;     // initialisation of pointer with the address of a

    printf("%d",*ptr);   // printing the value in a by deferencing a pointer


    return 0;


}



The above program demonstrate the use of pointer in c programming , it is one of the most important concept in c programming.
7:50 PM   Posted by Unknown with No comments
Read More
Arrays is a very interesting concept in c programming as it allow to store multiple values in a variable
now i will wirte a program to demonstrate a program to show how arrays works


#include<stdio.h>

int main()

{

        int array[3];     // array declaration

        array[0] = 5;   //array initilisation   of 1st element

        array[1] = 6;

        array[2] = 7;

        printf("%d",array[0]);


        return 0;



}


The above program demonstrate use of array like every variable which has a data type arrays also have a data type which decide the kind of value that we can store in a array also when we declare a array we have to specify how many elements we want to store in a array, one important think to note is that array element start from 0 , so in a array of n element we can store (n - 1) elements






7:42 PM   Posted by Unknown with No comments
Read More
In any programming language the ability of the language to reuse a peice of code  is vital and in C programming function provide us to way to do repetetive task easily, now i write a simple function that weil demonstrate the use of functions

#include<stdio.h>

int main()
{
 
        hello();     //calling a function

  }


   void hello()                  //defining a function header
{

     printf("hello world");       //function body

}
   

In above program we have written a very small function which allow us to print words hello world on the screen , the word void before the function name indicates the return value of function which in this case is none , every function returns a result which can be either integer, char, float or double or none is good practice to prefix function name with its return type



7:32 PM   Posted by Unknown with No comments
Read More
#include<stdio.h>

int main()


{

    char str[5];
    
    gets(str);  //reads a string of character from keyboard ****NOT SAFE TO USE****
    
    puts(str);  //prints string to the console
    
    
    getchar(); //waits for a character
    
    return 0;  //successful termination of the program
    
}
12:33 AM   Posted by Unknown with No comments
Read More

#include<stdio.h>


int main()


{

    int a; //integer declaration

    a = getc(stdin); //reads a single character into a

    
    fflush(stdin); //flushes the carriage return
    
    putc(a,stdout); //prints to the standard output the value of a
    
    getchar();      //waits for character input
    
    return 0;
    
}
12:32 AM   Posted by Unknown with No comments
Read More
#include<stdio.h>

int main()


{

    int i;

    for(i = 1 ; i < 10 ; i++)

    
            {
                printf("hello world\n");
                
                }
                
getchar();

return 0;


}
12:31 AM   Posted by Unknown with No comments
Read More
#include <stdio.h>
#include <conio.h>
#include <process.h>
int  main()
{

// under DOS PSP segment
printf("\n\t Program's process identification");
printf(" number  is : %d",getpid());
getch();

}
12:30 AM   Posted by Unknown with No comments
Read More
#include<stdio.h>

#define max 100  


int main()


{

    #undef max 
    
    if((max) == 100)
    
    {
           printf("max is eq 100");
           
           }
           
           getchar();
           
           return 0;
           
           }
         
12:28 AM   Posted by Unknown with No comments
Read More
#include <stdio.h>

int main() {


  printf( "Upper case of A is %c\n", toupper('A'));

  printf( "Upper case of 9 is %c\n", toupper('9'));
  printf( "UpperLower case of g is %c\n", toupper('g'));
  getchar();
  return 0;
}
12:28 AM   Posted by Unknown with No comments
Read More
#include <stdio.h>

int main() {


  printf( "Lower case of A is %c\n", tolower('A'));

  printf( "Lower case of 9 is %c\n", tolower('9'));
  printf( "Lower case of g is %c\n", tolower('g'));
  getchar();
  return 0;
}
12:27 AM   Posted by Unknown with No comments
Read More
#include<stdio.h>

int main()


{

    
    char str[10];
    
    int len;
    
    scanf("%[^\n]s",str);
    
   // strcpy(str,"shri");
    
    
    
    printf("%s",str);
    
    len = strlen(str);
    
    printf("%d",len);
    
    fflush(stdin);
    
    getchar();
    
    return 0;
    
}
12:26 AM   Posted by Unknown with No comments
Read More
#include<stdio.h>

int main()


{

    char str[10];
    
    char str1[10];

    strcpy(str,"shri");

    
    strcpy(str1,"roger");
    
    strcat(str,str1);
    

    printf("%s",str);


    getchar();


    return 0;


}
12:25 AM   Posted by Unknown with No comments
Read More
#include<stdio.h>

int main()


{

    char str[10];
    
    strcpy(str,"shri");
    
    printf("%s",str);
    
    getchar();
    
    return 0;
    
}
12:25 AM   Posted by Unknown with No comments
Read More
#include <stdio.h>
#include <math.h> /* needed by sqrt() */

int main(void)

{
  double answer;

  answer = sqrt(100.0);

  printf("%f", answer);

  return 0;

}

12:22 AM   Posted by Unknown with No comments
Read More
#include<stdio.h>

int main()


    {

          char str[15];             //string variable declaration
          
          scanf("%s",str);          //scanf read a string from keyboard until first white space
          
          printf("the value of str is %s\n",str); //printf prints the string to the console
          
          fflush(stdin);    //flushes the carriage return not read by scanf
          
          scanf("%[^\n]s",str); //read the str including the white space
          
          printf("the value of str is %s\n",str);
          
          fflush(stdin);    //flushes the carriage return not read by scanf
          
          getchar();        //waits for the user to press a character
          
          }
          
12:21 AM   Posted by Unknown with No comments
Read More
#include <dirent.h>



int main ()

{
  rmdir("d:\\ndir");


   getchar();
    return 0;

}
12:20 AM   Posted by Unknown with No comments
Read More
#include <stdio.h>

int main()
{
  rename("C:\\license.txt", "c:\\IN3.txt");
  
  getchar();
  return 0;
}
12:19 AM   Posted by Unknown with No comments
Read More
#include<stdio.h>

int main()

{
    int a = 100;

    printf("the value of integer of a is %d",a);
    
    getchar();
    
    return (0);
    
}

    
    

12:18 AM   Posted by Unknown with No comments
Read More
  #include <math.h>
  #include <stdio.h>

  int main(void)

  {
    double x = 10.0, y = 2.0;

    printf("%f",pow(x,y));

    
    getchar();
    return 0;
  }

12:17 AM   Posted by Unknown with No comments
Read More
#include <dirent.h>



int main ()

{
  mkdir("d:\\ndir");

    return 0;

}
12:16 AM   Posted by Unknown with No comments
Read More
#include <stdio.h>

int main() {


  if( isxdigit( 'Z' ) )

  {
     printf( "Character Z is Hexa digit\n" );
  }
  if( isxdigit( 'A' ) )
  {
     printf( "Character A is Hexa digit\n" );
  }
  
  getchar();
  return 0;
}
12:15 AM   Posted by Unknown with No comments
Read More
#include <stdio.h>

int main() {


  if( isspace( ' ' ) )

  {
     printf( "Character  is a space\n" );
  }
  if( isspace( 'A' ) )
  {
     printf( "Character  A is a space\n" );
  }
  return 0;
}
12:14 AM   Posted by Unknown with No comments
Read More
#include <stdio.h>

int main() {

  if( isupper( 'a' ) )
  {
     printf( "Character a is upper case\n" );
  }
  if( isupper( 'A' ) )
  {
     printf( "Character A is upper case\n" );
  }
  
  getchar();
  return 0;

12:13 AM   Posted by Unknown with No comments
Read More
#include <stdio.h>

int main() {


  if( ispunct( '<' ) )

  {
     printf( "Character  < is a punctuation\n" );
  }
  if( ispunct( 'A' ) )
  {
     printf( "Character  A is a punctuation\n" );
  }
  
  
  getchar();
  return 0;
}

12:12 AM   Posted by Unknown with No comments
Read More
#include <stdio.h>

int main() {

  if( islower( 'a' ) )
  {
     printf( "Character a is lower case\n" );
  }
  if( islower( 'A' ) )
  {
     printf( "Character A is lower case\n" );
  }
  
  
  getchar();
  return 0;
}
12:11 AM   Posted by Unknown with No comments
Read More
#include <stdio.h>

int main() {


  if( isdigit( '9' ) )

  {
     printf( "Character 9 is a digit\n" );
  }
  if( isdigit( 'A' ) )
  {
     printf( "Character A is digit\n" );
  }
  
  getchar();
  return 0;
}
12:10 AM   Posted by Unknown with No comments
Read More
#include<stdio.h>

int main()


{

    char ch;
    
    ch = getchar();
    
    if(iscntrl(ch))
    
    {
                   printf("k");
                   
                   }
                   
                   else
                   
                   {
                       printf("jjjj");
                       
                       }
                       
                       fflush(stdin);
                       
                       getchar();
                       
                       return 0;
                       
                       }














12:09 AM   Posted by Unknown with No comments
Read More
#include<stdio.h>

int main()
{
    char c;
scanf( "%c", &c );
if( isalpha(c) )
  printf( "You entered the alphanumeric character %c\n", c );


fflush(stdin);

getchar();

return 0;

}
12:08 AM   Posted by Unknown with No comments
Read More
#include<stdio.h>
int main()


{
    
    
   char c;
scanf( "%c", &c );
if( isalnum(c) )
  printf( "You entered the alphanumeric character %c\n", c );


fflush(stdin);

getchar();

return 0;

}
   
   
12:07 AM   Posted by Unknown with No comments
Read More
#include<stdio.h>

#define max 100



int main()

{
    #undef max
    
    #ifndef max
    
    {
                printf("max is undefined");
                
                }
                
    #endif
    
    getchar();
    
    return 0;
    
}
12:06 AM   Posted by Unknown with No comments
Read More
#include<stdio.h>

int main()

{
    int a = 100;
    
    int b = 50;
    
    if(a < b)
    
    {
         printf("a is lt b");
         
         }
         
    else
    {
        printf("a is gt b");
        
        }
        
    getchar();
    
    return 0;
    
}
12:05 AM   Posted by Unknown with No comments
Read More
#include<stdio.h>

#define max 100


int main()

{
    #ifdef max
    
    {
               printf("max is 100");
               
               }
               
    #endif
    
    getchar();
    
    return 0;
    

12:05 AM   Posted by Unknown with No comments
Read More
#include<stdio.h>

int main()

{

    int a = 200;
    
    int b = 500;
    
    if(a < b)
    
    {
         printf("a is lt b");
         
         }
         
    getchar();
    
    return 0;
    
}
12:03 AM   Posted by Unknown with No comments
Read More
#include<stdio.h>

int main()


{

    int a = 115; //integer variable a is initialised
    
    putchar(a); //reads the ascii value of 115
    
    getchar(); //waits for the character input
    
    return 0;  //normal termination
}
12:01 AM   Posted by Unknown with No comments
Read More
#include <stdio.h>
#include <conio.h>

int main()

  {
    int c;

    printf( "Press any key\n" );

    c = getch();
    printf( "You pressed %c(%d)\n", c, c );
    
    getchar();
    
    return 0;
  }
12:00 AM   Posted by Unknown with No comments
Read More

Saturday, January 25, 2014

#include<stdio.h>

int main()


{

    int a;
    
    fscanf(stdin,"%d",&a);
    
    printf("%d",a);
    
    getchar();
    
    return 0;
    
}
11:59 PM   Posted by Unknown with No comments
Read More
/* freopen example: redirecting stdout */
#include <stdio.h>

int main ()

{
  freopen ("myfile.txt","w",stdout);
  printf ("This sentence is redirected to a file.");
  fclose (stdout);
  return 0;
}

11:58 PM   Posted by Unknown with No comments
Read More
#include<stdio.h>

int main()


{

    int a = 100;
    
    fprintf(stdout,"%d",a);
    
    getchar();
    
    return 0;
    
}
11:54 PM   Posted by Unknown with No comments
Read More
#include<stdio.h>

int main()

{
    char str[5]; //declaration of character array
    
    fgets(str,5,stdin);  //better control than gets
    
    fputs(str,stdout);//prints the string of characters to  the console

    fflush(stdin); //flushes the carriage return
    
    getchar();               //waits for character input
    
    return 0;                //EXIT_SUCCESS
    
}
11:53 PM   Posted by Unknown with No comments
Read More
#include <stdio.h>
#include <stdlib.h>


int main()

{


FILE *fp;

fpos_t pos;

char c;

char d;

fp = fopen("test.txt","r");

if(fp == NULL)
{
perror("");
exit(1);
}

//c = fgetc(fp);

    //d = fgetc(fp);

fgetpos(fp,&pos);



printf("%c \n",c);

// printf("%c \n",d);

printf("%d",pos);

getchar();

return 0;

}
11:52 PM   Posted by Unknown with No comments
Read More
#include <stdio.h>

int main()

{


char c;




c = fgetchar();

printf("%c",c);



getchar();

return 0;

}
11:51 PM   Posted by Unknown with No comments
Read More
#include<stdio.h>

int main()



{


int a;

scanf("%d",&a);  //read a integer from stdin

printf("%d",a);  //prints to the console

fflush(stdin); //flushes the carriage return we press after entering the integer


getchar();  //wait for a keyboard input


return 0;



}
11:50 PM   Posted by Unknown with No comments
Read More
#include <stdio.h>

int main()

{
   FILE *fp;
   int d;
int c = 7;

   fp = fopen("file.txt", "r");

   
   
   fputc(c,fp);
   if(ferror(fp))
   {
    perror("");
   }
   
 d = (ferror(fp));
   
   
   
   
    printf("%d",d);
   
   
   
   
   
   
   
   return(0);
}

11:49 PM   Posted by Unknown with No comments
Read More


#include <stdio.h>


int main(void)

{
    char buffer[256];
    FILE * myfile;

    myfile = fopen("some.txt","r"); //opens and file for reading

    while (!feof(myfile))  //tests whether end of file is reached and continues to read as long as end is not reached
    {
        fgets(buffer,256,myfile);
        printf("%s",buffer);
    }

    fclose(myfile);
    
    return 0;
}

11:48 PM   Posted by Unknown with No comments
Read More
#include <stdio.h>

int main()

{
   FILE *fp;

   fp = fopen("file.txt", "w");

   fprintf(fp, "%s", "This is tutorialspoint.com");

   fclose(fp);
   
   return(0);
}

11:47 PM   Posted by Unknown with No comments
Read More
/************************************************************************

This example creates the file sample.dat so it can be read from and written to.
************************************************************************/


#include <sys\stat.h>


#include <io.h>


#include <stdio.h>


#include <stdlib.h>




int main(void)


{


   int fh;




   fh = creat("sample.txt", _S_IREAD);


   if (-1 == fh) {


      perror("Error in creating sample.txt");


      return EXIT_FAILURE;


   }


   else


      printf("Successfully created sample.txt.\n");


   close(fh);


   return 0;




   /****************************************************************************


      The output should:




       Successfully created sample.dat.


   ****************************************************************************/


}


11:46 PM   Posted by Unknown with No comments
Read More

Bookmark Us

Delicious Digg Facebook Favorites More Stumbleupon Twitter

Search