#include<stdio.h>
#include<conio.h>

int main()
{
    int no;
    
    scanf("%d", &no);
    
    
    
    printf("%d %d", no,no++);
    
    getch();return 0;
}

the output of this program is '4 3'.. my questino is WHY? this program should first print the number which is entered.. and then when it prints the next number it should add 1 to the number and then print it.. shouldnt it?

its not doig that..WHY?

Recommended Answers

All 2 Replies

Your not guaranteed how the arguments in printf are evaluated, left to right, right to left..It depends on the C compiler your using!!!!!!!!!!!!!!!!!!!!!(many ! so the reply is urgent).

thanks gerard, that was really helpful.. =)

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.