Belajar pemrograman bahasa C - Input output
Operasi Input
- Standard library function that related to input output operations are:
scanf();
getchar();
getch();
getche();
gets();
etc.
- input operation : function/operation of getting the data into the memory using standard I/O devices (keyboard, disk, etc.)
scanf() function
• Header file stdio.h
• Format:
int scanf( const char *format [,argument]... );
• All the argument type are pointers (the address of a variable)
• To get the address of a variable use & sign.
• Example :
int aValue;
scanf(”%d”,&aValue);
• Input format: ”% type”
where type can be substitute with one of the following list:
scanf() function
• scanf() function return an integer that stated how many field are successfully assigned.
• Example :
int x,y,z,w;
x=scanf("%d %d %d",&y,&z,&w);
• Input three values of integer 6 7 8, then x = 3; • Input four values 6 7 8 9 then x = 3 (successfully assign 3 variables y z w)
Output operation
printf();
putchar();
putch();
puts();
etc.
Printf() function
• Display some data on the standard output, using certain format.
• Standard output is the monitor.
• syntax :
printf(const char *format[,argument, …]);
• Header file : stdio.h
• Example : (next slide)



0 Komentar:
Posting Komentar
Berlangganan Posting Komentar [Atom]
<< Beranda