What is the difference between printf and scanf )?



What is the difference between printf and scanf )?..

Answer / Jitesh Prakash

The primary difference between printf and scanf in C programming lies in their functionality. printf is a standard library function used for outputting data to the console, while scanf is used for inputting data from the console. printf accepts arguments of various types (such as integers, floats, strings) and formats them according to specific format specifiers ("%d", "%f", etc.) printed within its parentheses. On the other hand, scanf reads formatted data from the standard input stream and stores it into variables passed by reference in the function call.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

what is array?

8 Answers  


void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply

1 Answers  


Just came across this question, felt worth sharing, so here it is I want you to make a C/C++ program that for any positive integer n will print all the positive integers from 1 up to it and then back again! Let's say n=5 I want the program to print: 1 2 3 4 5 4 3 2 1. Too easy you say? Okay then... You can ONLY USE: 1 for loop 1 printf/cout statement 2 integers( i and n) and as many operations you want. NO if statements, NO ternary operators, NO tables, NO pointers, NO functions!

1 Answers  


how to capitalise first letter of each word in a given string?

1 Answers  


Find errors (1) m = ++a*5; (2) a = b ++ -c*2; (3)y = sqrt (1000);

5 Answers  


A.C func() { pritnf(" in fuction %d",MACRO); } MAIN.c testfunc() { #define MACRO 10 printf("in test function %d", MACRO); } main() { printf("in main %d",MACRO); func(); testfunc(); getch(); }

2 Answers   Wipro,


What is sizeof c?

1 Answers  


Write a program to print all the prime numbers with in the given range

8 Answers   ABC, College School Exams Tests, TCS,


Write a program to generate the Fibinocci Series

1 Answers   TISL,


How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

1 Answers  


What are the types of i/o functions?

1 Answers  


if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0

1 Answers  


Categories