what is difference between getchar,putchar functions and
printf and scanf function? does putchar show output only
when input given to it
Answers were Sorted based on User's Feedback
Answer / jeevi
getchar is used to get only one character.. putchar is used
to print only one character.
printf can print more than one character,we can get more
than one variable by using scanf.
Is This Answer Correct ? | 47 Yes | 11 No |
Answer / moses
getchar gets a character,printf prints the text,scanf read
the input,putchar prints the character of getchar....
Is This Answer Correct ? | 11 Yes | 4 No |
Answer / akash kumar
getchar() reads one character from the "standard input",which is usually the user's keyboard. the syntax of the getchar() function is written as: character variable=getchar(). putchar() read's one character from the " standard output", which is usually the user's keyboard. the syntax of the putchar() function is written as : putchar ( character variable ). printf print the text , scanf reads the input .....
Is This Answer Correct ? | 8 Yes | 4 No |
Answer / mudra
The standard C library provides several functions and macros for character 1/0. Here we consider the getchar and putchar macros. As these macros read or write a single character, they are typically used in a loop to read/write a sequence of characters.
A macro call is similar to a function call. Thus, it consists of a macro name followed by a comma-separated argument list enclosed in a pair of parentheses. If a macro does not require any arguments, the pair of parentheses must still be used.
The getchar macro is used to read a single character from the standard input stream, i. e., the keyboard. A call to get char takes the following form: getchar (). This macro waits until a key is pressed and then returns its value (after converting to integer). The value returned can be assigned to a variable of type char. However, note that this macro actually reads the data from the input buffer which is processed by program only when the Enter key is pressed. Thus, getchar does not return a value until the user presses the Enter key. As a result, it is not suitable for interactive programs. We can instead use the getch and getche functions which directly read the data from the keyboard.
The putchar macro is used to write a single character on the standard output stream (i.e., display). A call to this macro takes the following form: putchar (c), where c is an integer expression representing the character being written. Although this macro expects an argument of type int, we usually pass a character to it. The argument value (c) is converted to unsigned char and written to the standard output stream.
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / suji
getchar() gets only one character from the input.putchar
prints that character.printf prints the text that enter
within doublequotes.scanf gets morethan one input from
console.getchar & putchar gets&puts from & to file.
Is This Answer Correct ? | 6 Yes | 8 No |
I have a function which accepts, and is supposed to initialize,a pointer, but the pointer in the caller remains unchanged.
Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?
What is omp_num_threads?
why we wont use '&' sing in aceesing the string using scanf
what are the advantages of a macro over a function?
Explain can you assign a different address to an array tag?
When should you not use a type cast?
1 232 34543 4567654 can anyone tell me how to slove this c question
Write a C program linear.c that creates a sequence of processes with a given length. By sequence it is meant that each created process has exactly one child. Let's look at some example outputs for the program. Here the entire process sequence consists of process 18181: Sara@dell:~/OSSS$ ./linear 1 Creating process sequence of length 1. 18181 begins the sequence. An example for a sequence of length three: Sara@dell:~/OSSS$ ./linear 3 Creating process sequence of length 3. 18233 begins the sequence. 18234 is child of 18233 18235 is child of 18234 ........ this is coad .... BUt i could not compleate it .....:( #include <stdio.h> #include <sys/types.h> #include <unistd.h> #include <stdlib.h> int main(int argc, char *argv[]) { int N; pid_t pid; int cont; if (argc != 2) { printf("Wrong number of command-line parameters!\n"); return 1; } N = atoi(argv[1]); printf("Creating process sequence of length %d.\n",N); printf("%d begins the sequence.\n",getpid()); /* What I have to do next ?????? */ }
Are bit fields portable?
what is pointer?
What are the differences between new and malloc in C?