#include <stdio.h>

int main(void)

{

    int ten = 10;

    int two = 2;



    printf("Doing it right: ");

    printf("%d minus %d is %d\n", ten, 2, ten - two );

    printf("Doing it wrong: ");

    printf("%d minus %d is %d\n", ten );  // forgot 2 arguments



    return 0;

}

hello actually i coulnt understand the lines here 

  printf("%d minus %d is %d\n", ten );  // forgot 2 arguments

they do not define arguments over here

An argument is also called a parameter, if you've heard that before? An argument is a piece of data passed to a function to be used within that function. In the case of printf, the format string, the first argument, specifies three '%d' markers, which indicate to printf that there will be three arguments to follow, and these should be placed at these markers in the order they were supplied in the function.

Try this:

#include <stdio.h>
int main(void)
{
    int ten = 10;
    int two = 2;
    printf("Doing it wrong: ");
    printf("%d minus %d is %d\n", ten );  // forgot 2 arguments
    printf("Doing it right: ");
    printf("%d minus %d is %d\n", ten, 2, ten - two );
    return 0;
}

and see if the answer is the same.
On compiation time it should give you some warnings, as:
"warning: format '%d' expects a matching 'int' argument [-Wformat]"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.