C language uses only one method for parameter-passing: call by value.
It is not. It is known as a common library function which performs formatted output.
No, it is a function. But printf does return a value: the number of characters it has written.
we write printf() b/c it printf or show us the value contained in a value on the screen after pressing ctrl+f9.
# include<stdio.h> # include<conio.h> void main() { clrscr(); int a,b; printf ("Enter the first value:"); scanf ("%d",& a ); printf ("Enter the second value:"); scanf ("%d",& b ); printf ("\n\nBefor swaping the values "); printf ("\nThe first value is %d",a); printf ("\nThe second value is %d",b); printf ("\n\nAfter swaping the values "); printf ("\nThe first value is %d",b); printf ("\nThe second value is %d",a); }
void main() { //variable declaration int a; int b; printf("\n Enter the first value"); scanf("%d",&a); printf("\n Enter the second value"); scanf("%d",&b); a=a+b; b=a-b; a=a-b; printf("\n After swap the value"); printf("\n value of A=%d",a); printf("\n value of A=%d",b); getch(); }
int main() { // Call the printf function printf("This is a function call!\n"); return 0; }
printf is declared in stdio.hFormat specifier for an integer value is %d.
void main() { int a,b,c; clrscr(); printf("Enter the value of a:"); scanf("%d",&a); printf("\nEnter the value of b:"); scanf("%d",&b); printf("\nEnter the value of c:"); scanf("%d",&c); if(a>b) { if(a>c) { if(b>c) { printf("c is smallest\n"); printf("b is middle\n"); printf("a is largest\n"); } else { printf("b is smallest\n"); printf("c is middle\n"); printf("a is largest\n"); } } else { printf("b is smallest\n"); printf("a is middle\n"); printf("c is largest\n"); } } else if(b>c) { if(a>c) { printf("c is smallest\n"); printf("a is middle\n"); printf("b is largest\n"); } else { printf("a is smallest\n"); printf("c is middle\n"); printf("b is largest\n"); } } else { printf("a is smallest\n"); printf("b is middle\n"); printf("c is largest\n"); } getch(); }
try to usecondition ? value if true : value if falseor: if (printf ("Hello")) {}
//Made for 5 inputs THIS PROGRAM IS NOT COMPILED OR CHECKED SO PLEASE DO SO#include#includevoid main(){int arr[5], i,c,val;clrscr();for(i = 0; i
#include stdio.h #include conio.h void main() { void intrchng(int*,int*); int a,b; printf("enter 1st value a:"); scanf("%d",&a); printf("\nenter 2nd value b:"); scanf("%d",&b); printf("\n after interchanging,outputs are\n"); intrchng(&a,&b); printf("value of a: %d",a); printf("value of b:%d",b); } void intrchng(int* ptra,int* ptrb) { int* temp; temp = ptra; ptra= ptrb; ptrb= temp; } }
empty format-string.
While calling a function, if the arguments supplied are the original values it is called call by value. e.g. int sum(int a, int b) { return (a+b); } int main() { int a=10; int b=20; printf("Sum is %d",sum(a,b)); return 1; }