Example:
printf ("There is one semicolon; in this string");
printf ("There is no semicolon in this string");
It is not a command, it is a function. Still, you can do funny programs like this:
if (printf ("Hello, World")) {}
Note: never do this in an actual program.
It isn't a command, it's a function. And yes, you can if you are stupid enough; the result may or may not be what you to want.
If you forget the semicolon, your program won't compile.
Sure.for (i=0; i
I believe, you can use C-function - printf().
semicolon ';' (Not applicable for block-statements)
Yes. However, C is a type-sensitive language thus PRINTF and printf would need to be defined as separate functions. However, names using all caps are conventionally used to denote macros in C thus you can easily define PRINTF as an alias for printf: #define PRINTF printf; int main (void) { PRINTF ("%d", 42); } The C precompiler will substitute all instances of the symbol PRINTF with printf, thus the code seen by the compiler will become: int main (void) { printf ("%d", 42); }
If you forget the semicolon, your program won't compile.
try to usecondition ? value if true : value if falseor: if (printf ("Hello")) {}
You can use fputs() instead of printf().
Sure.for (i=0; i
int main () {}
I believe, you can use C-function - printf().
semicolon ';' (Not applicable for block-statements)
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(); }
Yes. However, C is a type-sensitive language thus PRINTF and printf would need to be defined as separate functions. However, names using all caps are conventionally used to denote macros in C thus you can easily define PRINTF as an alias for printf: #define PRINTF printf; int main (void) { PRINTF ("%d", 42); } The C precompiler will substitute all instances of the symbol PRINTF with printf, thus the code seen by the compiler will become: int main (void) { printf ("%d", 42); }
main() { if(printf("%c",59)) }
Whoever said so, they were wrong. For sure "printf" can be used without any problem.
#include<stdio.h> #include<conio.h> void main() { int a,b,c; clrscr(); printf("Enter any three numbers"); scanf("%d%d%d",&a,&b,&c); if(a>b&&a>c) printf("A is greatest"); else if(b>a&&a>c) printf("B is greatest"); else if(c>a&&c>b) printf("C is greatest"); if(a<b&&a<c) printf("A is smallest"); else if(b<a&&b<c) printf("B is smallest"); else if(c<a&&c<b) printf("C is smallest"); getch(); }