answersLogoWhite

0


Best Answer

I think you can use 'printf' like blew, int printf( const char *format [, argument]... );

int _printf_l( const char *format, locale_t locale [, argument]... );

int wprintf( const wchar_t *format [, argument]... );

int _wprintf_l( const wchar_t *format, locale_t locale [, argument]... );

at the same time, I give a example using the 'printf',

/** * example using the 'printf' */

  1. include

int main() { int e; int i; e = _set_printf_count_output( 1 ); printf( "%%n support was %sabled.\n", e ? "en" : "dis" ); printf( "%%n support is now %sabled.\n", _get_printf_count_output() ? "en" : "dis" ); printf( "12345%n6789\n", &i ); // %n format should set i to 5 printf( "i = %d\n", i ); }

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Syntax of printf
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Computer Science

C code for sliding window protocol?

#include<stdio.h> #include<conio.h> void main() { char sender[50],receiver[50]; int i,winsize; clrscr(); printf("\n ENTER THE WINDOWS SIZE : "); scanf("%d",&winsize); printf("\n SENDER WINDOW IS EXPANDED TO STORE MESSAGE OR WINDOW \n"); printf("\n ENTER THE DATA TO BE SENT: "); fflush(stdin); gets(sender); for(i=0;i<winsize;i++) receiver[i]=sender[i]; receiver[i]=NULL; printf("\n MESSAGE SEND BY THE SENDER:\n"); puts(sender); printf("\n WINDOW SIZE OF RECEIVER IS EXPANDED\n"); printf("\n ACKNOWLEDGEMENT FROM RECEIVER \n"); for(i=0;i<winsize;i++); printf("\n ACK:%d",i); printf("\n MESSAGE RECEIVED BY RECEIVER IS : "); puts(receiver); printf("\n WINDOW SIZE OF RECEIVER IS SHRINKED \n"); getch(); }


Push and pop in stack programs in c?

#include<stdio.h> #include<conio.h> #include<math.h> #define stack_size 5 int top,item,s1[0]; void push() { if(top==stack_size-1) { printf("stack overflow\n"); return; } top=top+1; s[top]=item; } int pop() { int item_deleted; if(top==-1) return 0; item_deleted=s[top--]; return item_deleted; } void display() { int i; if(top==-1) { printf("stack is empty\n"); return; } printf("contents of the stack\n"); for(i=0;i<=top;i++) { printf("%d\n",s[i]); } } void main() { int item,item_deleted,choice; top=-1; for(;;) { printf("1.push\n 2.pop\n 3.display\n 4.exit\n"); printf("enter the choice\n"); scanf("%d\n",&choice); switch(choice) { case 1:Printf("enter the item to be inserted\n"); scanf("%d",&item); push(); break; case 2: item_deleted=pop(); if(item_deleted==0) printf("stack is empty\n"); else printf("item deleted = %d\n",item_deleted); break; case 3: display(); break; default: exit(0); } } }


Abstract syntax tree implementation in C language?

This is a sample implementation of a binary tree which does inserting nodes, searching in the tree for a specific node and deleting the tree#includetypedef struct bnode BinTree;struct bnode {char name[20];int count;BinTree *left;BinTree *right;};BinTree* InsertBinTree ( BinTree*, char* );BinTree* SearchBinTree ( BinTree*, char* );BinTree* DeleteInBinTree ( BinTree*, char* );void DisplayBinTree ( BinTree* );int main (){char ans, tmp, name[20];BinTree *root = NULL;printf ("\nInserting nodes...\n");do {printf ("Type the name of the node to insert: ");scanf ("c", name, &tmp);root = InsertBinTree(root, name);printf ("Another one (Y/N)? ");scanf("c", &ans, &tmp);} while (ans NULL )return NULL;while ( root->left != NULL )root = root->left;return root;}


What term used for a set of rules that must be strictly followed when writing a program is?

Syntax.


Gwbasic program to reverse a given number using while loop.?

#include<stdio.h> #include<conio.h> void main() { int no, ans; clrscr(); printf(input no. \n"); scanf("%d", &no); while(no!=0) { n=no%10; no=no/10; printf("%d",n); } getch(); }

Related questions

What is the function and syntax of printf statement?

it's not a statement, it's a function: len= printf (format, ...more-parameters...);


What is the syntax in getting the highest number in turbo C using the if statement?

#include <limits.h> if (1) { printf ("INT_MAX is %d\n", INT_MAX); printf ("LONG_MAX is %ld\n", LONG_MAX); }


What is an example of a syntax?

The way an author chooses to join words into phrases, clauses, and sentences. Syntax is similar to diction, but you can differentiate them by thinking of syntax as the groups of words, while diction refers to the individual words.


What is the syntax of for loop statement?

syntax: for(initialization;condition;increment) { statements s1; statements s2; } #include<stdio.h> main() { int i,n=5; for(i=0;i<n;i=i+1) { printf("the number s are %d", i); } }


How do you use if statement syntax in a for loop?

You can use any number of if staments within a for-loop, eg: for (i=0; i<10; ++i) { if (i=1) printf ("%d=1\n",i); }


What is use of printf?

printf() is a build-in function under the header file 'stdio.h' in a C programming language. In c++,the same function is accomplished by 'cout' . It is used to display strings enclosed between double quotes. Its syntax is printf("...string/sentences/characters...."); After execution,all the characters between the double quotes will be displayed on the output screen.


Which is the syntax for passing a structure member as an argument to a function?

struct example { int fld1, fld2; } x1; printf ("fld1=%d, fld2=%d\n", x1.fld1, x1.fld2);


Can you use nested printf?

printf ("nested printf returned %d\n", printf ("inner printf\n"));


C programming diamond shape for loops Problem and output sample is in the picture?

#include<stdio.h> main() { int i; for(i=1;i<=1;i++) { printf("*",i); } printf("\n"); for(i=1;i<=3;i++) { printf("*",i); } printf("\n"); for(i=1;i<=5;i++) { printf("*",i); } printf("\n"); for(i=1;i<=3;i++) { printf("*",i); } printf("\n"); for(i=1;i<=1;i++) { printf("*",i); } }


What is main function of printf in a C program?

The syntax for printf is: int printf(const char *format, ...); Simple usage examples: 1. Print character literal: printf("%c", 'a'); 2. Print character variable: printf("%c", my_char); 3. Print string literal: printf("%s", "hello world"); 4. Print string variable: printf("%s", my_string); 5. Print integer variable: printf("%d", my_integer); 6. Print floating-point variable: printf("%f", my_float);


How do you use pragma startup preprocessor directive?

Syntax:====================================================================================Suppose you want to print a Character for 50 (or so) Times before entering Main ().Here the code goes:#include "stdio.h"#include "conio.h"void PrintChars (){char cChar;int iTimes, iLoop;printf ("\n Enter a Character to print: ");scanf ("%c", &cChar);printf ("\n How many times you want \'%c\' to print", cChar);scanf ("%d", iTimes);for ( iLoop=1; iLoop


Write a program to find the largest of three numbers and print the output in ascending order?

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(); }