Strange result when trying to print

R R

After execution, result was very strange:

#include <stdio.h>
int main(){
  int a,b; 
  printf("enter two numbers :");
  scanf("%d%d",&a,&b);
  if(a>b){
    printf("maximum number is %d",&a);
  } 
  else{
    printf("maximum number is %d",&b);  
  }
  return 0; 
}

After enter two numbers in console result was:

maximum number is 2686696

2686696 very strange for me if I enter two numbers such as 5, 3 must shows me 5 but shows 2686696 !!!

Can anyone guide me?

Maroun

Remove & from printf to print the value, now you're printing the address. Should be:

printf("maximum number is %d",a);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

strange result when trying to increment a n php cookie

From Dev

Strange error message when trying to generate a PDF

From Dev

strange bug when trying to position <a> element

From Dev

Strange behaviour when trying to implement twisted deferredlist

From Dev

Strange behavior when trying to plot single values

From Dev

Strange error when trying to Get-ADUser

From Dev

A strange result when using reduce with prallelstream in Java

From Dev

Strange output for Binary Search when result is not found

From Dev

Strange result when downloading a csv via writeStream

From Dev

Result is not print when value is 0

From Dev

Trying to grep a find -print0 causes strange behavior

From Dev

Powershell - Strange result when exporting disk space result to CSV

From Dev

Seg fault when trying to print a string

From Dev

exception when trying to print an array in Java

From Dev

"Segmentation fault" when trying to print an integer

From Dev

nullexception when trying to print value of object

From Dev

Compiler error when trying to print from struct

From Dev

Seg fault when trying to print a string

From Dev

No match for ‘operator<<’ when trying to print vector element

From Dev

TypeError when trying to print contents of a numpy array

From Dev

Ambiguity error while trying to print result of JAVA8 Collector

From Dev

Strange ASCII response(chinese) when trying to replicate strlwr in codeblocks 13.12

From Dev

parsec produce strange errors when trying to handle Maybe as ParseError

From Dev

Receiving a strange Xcode error when trying to run app in iOS simulator

From Dev

Strange results when trying to check String value type

From Dev

Strange behaviour when trying to detect spaces and tabs in grammar

From Dev

Strange errors when trying to make HTTP requests with SolidWorks VBA

From Dev

parsec produce strange errors when trying to handle Maybe as ParseError

From Dev

Strange issue in Codeigniter when trying to select "product listings" by ID

Related Related

  1. 1

    strange result when trying to increment a n php cookie

  2. 2

    Strange error message when trying to generate a PDF

  3. 3

    strange bug when trying to position <a> element

  4. 4

    Strange behaviour when trying to implement twisted deferredlist

  5. 5

    Strange behavior when trying to plot single values

  6. 6

    Strange error when trying to Get-ADUser

  7. 7

    A strange result when using reduce with prallelstream in Java

  8. 8

    Strange output for Binary Search when result is not found

  9. 9

    Strange result when downloading a csv via writeStream

  10. 10

    Result is not print when value is 0

  11. 11

    Trying to grep a find -print0 causes strange behavior

  12. 12

    Powershell - Strange result when exporting disk space result to CSV

  13. 13

    Seg fault when trying to print a string

  14. 14

    exception when trying to print an array in Java

  15. 15

    "Segmentation fault" when trying to print an integer

  16. 16

    nullexception when trying to print value of object

  17. 17

    Compiler error when trying to print from struct

  18. 18

    Seg fault when trying to print a string

  19. 19

    No match for ‘operator<<’ when trying to print vector element

  20. 20

    TypeError when trying to print contents of a numpy array

  21. 21

    Ambiguity error while trying to print result of JAVA8 Collector

  22. 22

    Strange ASCII response(chinese) when trying to replicate strlwr in codeblocks 13.12

  23. 23

    parsec produce strange errors when trying to handle Maybe as ParseError

  24. 24

    Receiving a strange Xcode error when trying to run app in iOS simulator

  25. 25

    Strange results when trying to check String value type

  26. 26

    Strange behaviour when trying to detect spaces and tabs in grammar

  27. 27

    Strange errors when trying to make HTTP requests with SolidWorks VBA

  28. 28

    parsec produce strange errors when trying to handle Maybe as ParseError

  29. 29

    Strange issue in Codeigniter when trying to select "product listings" by ID

HotTag

Archive