how to skip the value in printf in c

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sravanthichinta
    New Member
    • Sep 2014
    • 1

    how to skip the value in printf in c

    #include<stdio. h>
    void main()
    {
    int i=6;
    printf("%d %*d\n",i,i+9);
    }
    what is the out put?
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    What happens is undefined behavior. The call to printf doesn't have enough arguments.

    Refer to man page for printf. The format string has two format specifies: "%d" and "%*d"; the first expects one argument and the second expects two arguments. Thus, three arguments should follow the format string but you only have two.

    Comment

    • mukherjee
      New Member
      • Sep 2014
      • 9

      #3
      It will most likely crash.

      Comment

      Working...