output of the program

int main()
unsigned a=25;
long unsigned b=25l;
printf("%u %lu",a,b);
plz help me… not understanding the role of l in b=25l; if we replace it by
b=25d; then it shows invalid suffix why?

1 Like

You have forgotten to include ‘#’ ie #include<stdio.h> and then run it.
output: 25 25

%u : for unsigned integers
%lu : for unsigned long long integers

Output of the Program will be : 25 25

l or L is a special character which can be used to indicate that this is a “long” constant and not just an int constant. So, in above code, the 25 is a long constant and not an integer constant.

You can read about the other suffixes available here: Integer literal - cppreference.com

1 Like

why l is not affecting the output of b?

thnks! but in b=25l; if we replace by b=25d;
then it will show invalid suffix why?..

Thanks for the link. I searched for the reason and couldn’t find it for 10 minutes. I was so confused about this after seeing this question.

1 Like

thnks for the answer and link …

1 Like