C Tutorials

C Project – How to Read a Password in C with Source Code 0

C Project – How to Read a Password in C with Source Code

Program 1 #include<stdio.h> #include<conio.h> #define clrscr() system(“cls”) int main() { static int i=0; char ch1,ch2,ch3,ch4; clrscr(); pin:printf(“\nEnter a pin: “); ch1=getch(); printf(“*”); ch2=getch(); printf(“*”); ch3=getch(); printf(“*”); ch4=getch(); printf(“*”); if(ch1==’1’&&ch2==’2’&&ch3==’3’&&ch4==’4′) printf(“\nYou are valid user”); else...

C Program to Run Command Line Argument with VSCode 0

C Program to Run Command Line Argument with VSCode

Program 1 #include<stdio.h> #include<conio.h> void main(int argc,char *argv[]) { printf(“\nTotal argument is %d”,argc); printf(“\nFirst argument is %s”,argv[0]); printf(“\nSecond argument is %s”,argv[1]); printf(“\nThird argument is %s”,argv[2]); printf(“\nFourth argument is %s”,argv[3]); }  

C Program For Preprocessor Directives 0

C Program For Preprocessor Directives

Program 1 #include<stdio.h> #include<conio.h> #define pf printf #define sf scanf #define add(a,b) a+b #define CUBE(n) n*n*n int add(int a,int b); void main() { int c; c=add(60,20); pf(“%d”,c); } int add(int a,int b) { int...

C Program to Copy Content of One File into Another File 0

C Program to Copy Content of One File into Another File

Program 1 // Program for copy one file into other #include<stdio.h> #include<conio.h> void main() { FILE *fp1,*fp2; char ch; fp1=fopen(“E://CData/employee.txt”,”r”); fp2=fopen(“E://CData/newemp.txt”,”w”); if(fp1==NULL || fp2==NULL) printf(“File Error…..”); else { do { ch=fgetc(fp1); fputc(ch,fp2); }while(ch!=EOF); fclose(fp1);...

How to Read Data from File in C Programming 0

How to Read Data from File in C Programming

Program 1 // Program for read data from file #include<stdio.h> #include<conio.h> void main() { FILE *fp=NULL; char ch; int csp=0,cc=0,cl=0; fp=fopen(“e://cdata/employee.txt”,”r”); // Read mode if(fp==NULL) //check file printf(“\nFile not open….\n”); else { do {...

How to Create File in C Programming 0

How to Create File in C Programming

Program 1 //Program for create file in C Language #include<stdio.h> #include<conio.h> void main() { FILE *fp=NULL; char ch; fp=fopen(“e://cdata/employee.txt”,”w”); if(fp==NULL) printf(“File not created………”); else { printf(“\nEnter a String: “); while(1) { ch=getche(); if(ch==’0′) break;...

C Program For Array of Structures 0

C Program For Array of Structures

Program 1 // Program for Array of Structure in C #include<stdio.h> #include<conio.h> #include<string.h> // Structure struct Student { int rno; // Member variable of Structure char name[50]; // Member variable of Structure , Array...