using scanf in c code example

Example 1: c scanf

scanf("%d",&variable);

/*
% is a format specifier

%d or %i 		for int
%ld or %li for 	long int
%f for 			float
%lf for 		double
%c for 			char
%s for 			string
*/

Example 2: scanf c

scanf("%d", &b);

Example 3: scanf in c

#include <stdio.h>

int main () {
   scanf("%s", str);
   printf("%s"str);
   scanf("%d", int);
   printf("%d"int);
   return(0);
}

Example 4: how to scan in c

scanf("%d",&int);

Example 5: print to screen c

printf("what do u print on screen");	//use \n  between "" 
										//to skip a line

Tags:

C Example