logo
down
shadow

Output for the following C code is confusing me


Output for the following C code is confusing me

By : Del Agato
Date : October 24 2020, 06:10 PM
I think the issue was by ths following , It is because you entered A and . The produces the second 1.
You can press CTRL + D on unix or CTRL + Z on Windows to close the stdin of the program instead of pressing . This will give you the expected output.
code :


Share : facebook icon twitter icon
Confusing output?

Confusing output?


By : Anil Savaliya
Date : March 29 2020, 07:55 AM
Any of those help I fail to understand is why does the code print '3' in VS2010 (release build), whether I leave the declaration of 'r' or comment it out. ,
&arr1[1] - &arr2[0]
F# confusing output

F# confusing output


By : user3490097
Date : March 29 2020, 07:55 AM
To fix this issue First of all its important to point out that innerMsgChange does not do what its name promises: It creates a new variable called msg (which is entirely unrelated to the outer variable which is also called msg) with the value "Very Important" and then prints it. So in essence it prints the string "Very Important" and that's it.
So which order is the code executed in? Simple:
confusing output

confusing output


By : Sourbh Dhingra
Date : March 29 2020, 07:55 AM
should help you out When you return a plain object rather than a reference, you're returning a copy of the object on which you called the method. setY acts on that copy (which is a temporary), then the copy is destructed.
When you return a reference, all the calls operate on the same object, so you get the behavior you're looking for.
Confusing about the output

Confusing about the output


By : user3643436
Date : March 29 2020, 07:55 AM
this will help I'm new to java programming. I just start to reading Head first java book. And I found this example on first chapter. , Yes, output should begin with,
code :
99 bottles of beer
99 bottles of beer on the wall
99 bottles of beer
Take one down.
Pass it around.
98 bottles of beer on the wall
98 bottles of beer on the wall
98 bottles of beer
Take one down.
Pass it around.
97 bottles of beer on the wall
97 bottles of beer on the wall
97 bottles of beer
Take one down.
Pass it around.
96 bottles of beer on the wall
96 bottles of beer on the wall
96 bottles of beer
Take one down.
Pass it around.
95 bottles of beer on the wall
95 bottles of beer on the wall
95 bottles of beer
Take one down.
Pass it around.
94 bottles of beer on the wall
94 bottles of beer on the wall
94 bottles of beer
Take one down.
Pass it around.
93 bottles of beer on the wall
93 bottles of beer on the wall
93 bottles of beer
Take one down.
Pass it around.
92 bottles of beer on the wall
92 bottles of beer on the wall
92 bottles of beer
Take one down.
Pass it around.
91 bottles of beer on the wall
91 bottles of beer on the wall
91 bottles of beer
Take one down.
Pass it around.
90 bottles of beer on the wall
90 bottles of beer on the wall
90 bottles of beer
Take one down.
Pass it around.
89 bottles of beer on the wall
89 bottles of beer on the wall
89 bottles of beer
Take one down.
Pass it around.
88 bottles of beer on the wall
88 bottles of beer on the wall
88 bottles of beer
Take one down.
Pass it around.
87 bottles of beer on the wall
87 bottles of beer on the wall
87 bottles of beer
Take one down.
Pass it around.
86 bottles of beer on the wall
86 bottles of beer on the wall
86 bottles of beer
Take one down.
Pass it around.
85 bottles of beer on the wall
85 bottles of beer on the wall
85 bottles of beer
Take one down.
Pass it around.
84 bottles of beer on the wall
84 bottles of beer on the wall
84 bottles of beer
Take one down.
Pass it around.
83 bottles of beer on the wall
83 bottles of beer on the wall
83 bottles of beer
Take one down.
Pass it around.
82 bottles of beer on the wall
82 bottles of beer on the wall
82 bottles of beer
Take one down.
Pass it around.
81 bottles of beer on the wall
81 bottles of beer on the wall
81 bottles of beer
Take one down.
Pass it around.
80 bottles of beer on the wall
80 bottles of beer on the wall
80 bottles of beer
Take one down.
Pass it around.
79 bottles of beer on the wall
79 bottles of beer on the wall
79 bottles of beer
Take one down.
Pass it around.
78 bottles of beer on the wall
78 bottles of beer on the wall
78 bottles of beer
Take one down.
Pass it around.
77 bottles of beer on the wall
77 bottles of beer on the wall
77 bottles of beer
Take one down.
Pass it around.
76 bottles of beer on the wall
76 bottles of beer on the wall
76 bottles of beer
Take one down.
Pass it around.
75 bottles of beer on the wall
75 bottles of beer on the wall
75 bottles of beer
Take one down.
Pass it around.
74 bottles of beer on the wall
74 bottles of beer on the wall
74 bottles of beer
Take one down.
Pass it around.
73 bottles of beer on the wall
73 bottles of beer on the wall
73 bottles of beer
Take one down.
Pass it around.
72 bottles of beer on the wall
72 bottles of beer on the wall
72 bottles of beer
Take one down.
Pass it around.
71 bottles of beer on the wall
71 bottles of beer on the wall
71 bottles of beer
Take one down.
Pass it around.
70 bottles of beer on the wall
70 bottles of beer on the wall
70 bottles of beer
Take one down.
Pass it around.
69 bottles of beer on the wall
69 bottles of beer on the wall
69 bottles of beer
Take one down.
Pass it around.
68 bottles of beer on the wall
68 bottles of beer on the wall
68 bottles of beer
Take one down.
Pass it around.
67 bottles of beer on the wall
67 bottles of beer on the wall
67 bottles of beer
Take one down.
Pass it around.
66 bottles of beer on the wall
66 bottles of beer on the wall
66 bottles of beer
Take one down.
Pass it around.
65 bottles of beer on the wall
65 bottles of beer on the wall
65 bottles of beer
Take one down.
Pass it around.
64 bottles of beer on the wall
64 bottles of beer on the wall
64 bottles of beer
Take one down.
Pass it around.
63 bottles of beer on the wall
63 bottles of beer on the wall
63 bottles of beer
Take one down.
Pass it around.
62 bottles of beer on the wall
62 bottles of beer on the wall
62 bottles of beer
Take one down.
Pass it around.
61 bottles of beer on the wall
61 bottles of beer on the wall
61 bottles of beer
Take one down.
Pass it around.
60 bottles of beer on the wall
60 bottles of beer on the wall
60 bottles of beer
Take one down.
Pass it around.
59 bottles of beer on the wall
59 bottles of beer on the wall
59 bottles of beer
Take one down.
Pass it around.
58 bottles of beer on the wall
58 bottles of beer on the wall
58 bottles of beer
Take one down.
Pass it around.
57 bottles of beer on the wall
57 bottles of beer on the wall
57 bottles of beer
Take one down.
Pass it around.
56 bottles of beer on the wall
56 bottles of beer on the wall
56 bottles of beer
Take one down.
Pass it around.
55 bottles of beer on the wall
55 bottles of beer on the wall
55 bottles of beer
Take one down.
Pass it around.
54 bottles of beer on the wall
54 bottles of beer on the wall
54 bottles of beer
Take one down.
Pass it around.
53 bottles of beer on the wall
53 bottles of beer on the wall
53 bottles of beer
Take one down.
Pass it around.
52 bottles of beer on the wall
52 bottles of beer on the wall
52 bottles of beer
Take one down.
Pass it around.
51 bottles of beer on the wall
51 bottles of beer on the wall
51 bottles of beer
Take one down.
Pass it around.
50 bottles of beer on the wall
50 bottles of beer on the wall
50 bottles of beer
Take one down.
Pass it around.
49 bottles of beer on the wall
49 bottles of beer on the wall
49 bottles of beer
Take one down.
Pass it around.
48 bottles of beer on the wall
48 bottles of beer on the wall
48 bottles of beer
Take one down.
Pass it around.
47 bottles of beer on the wall
47 bottles of beer on the wall
47 bottles of beer
Take one down.
Pass it around.
46 bottles of beer on the wall
46 bottles of beer on the wall
46 bottles of beer
Take one down.
Pass it around.
45 bottles of beer on the wall
45 bottles of beer on the wall
45 bottles of beer
Take one down.
Pass it around.
44 bottles of beer on the wall
44 bottles of beer on the wall
44 bottles of beer
Take one down.
Pass it around.
43 bottles of beer on the wall
43 bottles of beer on the wall
43 bottles of beer
Take one down.
Pass it around.
42 bottles of beer on the wall
42 bottles of beer on the wall
42 bottles of beer
Take one down.
Pass it around.
41 bottles of beer on the wall
41 bottles of beer on the wall
41 bottles of beer
Take one down.
Pass it around.
40 bottles of beer on the wall
40 bottles of beer on the wall
40 bottles of beer
Take one down.
Pass it around.
39 bottles of beer on the wall
39 bottles of beer on the wall
39 bottles of beer
Take one down.
Pass it around.
38 bottles of beer on the wall
38 bottles of beer on the wall
38 bottles of beer
Take one down.
Pass it around.
37 bottles of beer on the wall
37 bottles of beer on the wall
37 bottles of beer
Take one down.
Pass it around.
36 bottles of beer on the wall
36 bottles of beer on the wall
36 bottles of beer
Take one down.
Pass it around.
35 bottles of beer on the wall
35 bottles of beer on the wall
35 bottles of beer
Take one down.
Pass it around.
34 bottles of beer on the wall
34 bottles of beer on the wall
34 bottles of beer
Take one down.
Pass it around.
33 bottles of beer on the wall
33 bottles of beer on the wall
33 bottles of beer
Take one down.
Pass it around.
32 bottles of beer on the wall
32 bottles of beer on the wall
32 bottles of beer
Take one down.
Pass it around.
31 bottles of beer on the wall
31 bottles of beer on the wall
31 bottles of beer
Take one down.
Pass it around.
30 bottles of beer on the wall
30 bottles of beer on the wall
30 bottles of beer
Take one down.
Pass it around.
29 bottles of beer on the wall
29 bottles of beer on the wall
29 bottles of beer
Take one down.
Pass it around.
28 bottles of beer on the wall
28 bottles of beer on the wall
28 bottles of beer
Take one down.
Pass it around.
27 bottles of beer on the wall
27 bottles of beer on the wall
27 bottles of beer
Take one down.
Pass it around.
26 bottles of beer on the wall
26 bottles of beer on the wall
26 bottles of beer
Take one down.
Pass it around.
25 bottles of beer on the wall
25 bottles of beer on the wall
25 bottles of beer
Take one down.
Pass it around.
24 bottles of beer on the wall
24 bottles of beer on the wall
24 bottles of beer
Take one down.
Pass it around.
23 bottles of beer on the wall
23 bottles of beer on the wall
23 bottles of beer
Take one down.
Pass it around.
22 bottles of beer on the wall
22 bottles of beer on the wall
22 bottles of beer
Take one down.
Pass it around.
21 bottles of beer on the wall
21 bottles of beer on the wall
21 bottles of beer
Take one down.
Pass it around.
20 bottles of beer on the wall
20 bottles of beer on the wall
20 bottles of beer
Take one down.
Pass it around.
19 bottles of beer on the wall
19 bottles of beer on the wall
19 bottles of beer
Take one down.
Pass it around.
18 bottles of beer on the wall
18 bottles of beer on the wall
18 bottles of beer
Take one down.
Pass it around.
17 bottles of beer on the wall
17 bottles of beer on the wall
17 bottles of beer
Take one down.
Pass it around.
16 bottles of beer on the wall
16 bottles of beer on the wall
16 bottles of beer
Take one down.
Pass it around.
15 bottles of beer on the wall
15 bottles of beer on the wall
15 bottles of beer
Take one down.
Pass it around.
14 bottles of beer on the wall
14 bottles of beer on the wall
14 bottles of beer
Take one down.
Pass it around.
13 bottles of beer on the wall
13 bottles of beer on the wall
13 bottles of beer
Take one down.
Pass it around.
12 bottles of beer on the wall
12 bottles of beer on the wall
12 bottles of beer
Take one down.
Pass it around.
11 bottles of beer on the wall
11 bottles of beer on the wall
11 bottles of beer
Take one down.
Pass it around.
10 bottles of beer on the wall
10 bottles of beer on the wall
10 bottles of beer
Take one down.
Pass it around.
9 bottles of beer on the wall
9 bottles of beer on the wall
9 bottles of beer
Take one down.
Pass it around.
8 bottles of beer on the wall
8 bottles of beer on the wall
8 bottles of beer
Take one down.
Pass it around.
7 bottles of beer on the wall
7 bottles of beer on the wall
7 bottles of beer
Take one down.
Pass it around.
6 bottles of beer on the wall
6 bottles of beer on the wall
6 bottles of beer
Take one down.
Pass it around.
5 bottles of beer on the wall
5 bottles of beer on the wall
5 bottles of beer
Take one down.
Pass it around.
4 bottles of beer on the wall
4 bottles of beer on the wall
4 bottles of beer
Take one down.
Pass it around.
3 bottles of beer on the wall
3 bottles of beer on the wall
3 bottles of beer
Take one down.
Pass it around.
2 bottles of beer on the wall
2 bottles of beer on the wall
2 bottles of beer
Take one down.
Pass it around.
1 bottles of beer on the wall
1 bottle of beer on the wall
1 bottle of beer
Take one down.
Pass it around.
No more bottles of beer on the wall
Why following code snippets assignment gives confusing output?

Why following code snippets assignment gives confusing output?


By : sohaiblaraich
Date : March 29 2020, 07:55 AM
I hope this helps . For case 1, 'doe' is not a string.
Case 2 works because you are initializing you pointers with string literals.
Related Posts Related Posts :
  • Random function stuck on one number
  • printf following zeros to a certain degree
  • Measuring CPU clocks consumed by a process
  • How is a CRC32 checksum calculated?
  • Tips on redefining a register bitfield in C
  • Converting a program from c to bash script
  • Static library not included in resulting LLVM executable
  • What is the meaning of "wild pointer" in C?
  • Reading DWORD from binary file
  • Efficient way to find divisibility
  • Whats the fastest, portable way to hash pointers we know are pointer aligned to a fixed size int?
  • Why does my summation program behaves weird?
  • How to determine values saved on the stack?
  • Thread scheduling C
  • C - converting to 2s complement
  • wireless networks c program
  • From where does the uboot get the information about flash, RTC, RAM in uboot/kernel development
  • printf behaviour in C
  • Measure size and way-order of L1 and L2 caches
  • Efficient copy of entire directory
  • Efficient way to create/unpack large bitfields in C?
  • getnameinfo prototype asks for sockaddr not sockaddr_in?
  • Linked List Sorting with Strings In C
  • Typecasting a floating value or using the math.h floor* functions?
  • Problem implementing sorting algorithm in C with an array of structs
  • How to copy a ram_base file to disk efficiently
  • How to fix casting a pointer to an integer?
  • How to round floating point numbers to the nearest integer in C?
  • PIC C - Sending 200 values over USB, but it only sends 25 or so of them
  • How do you return a string from a function correctly in Dynamic C?
  • Monotonic clock on IRIX
  • setsockopt (sys/socket.h)
  • How to make C program wait (on Linux)?
  • i find a problem using atoi() method in ansi c?
  • Why is this array being initialized in an odd way?
  • How to execute commands in chroot?
  • Microsecond (or one ms) time resolution on an embedded device (Linux Kernel)
  • Question about variable definitions in functions
  • SMTP on C: STARTTLS via OpenSSL
  • fetch value of ipaddress
  • Binary expressions in C
  • Why do char * and char ** have the same value?
  • problem in allocating kernel memory by malloc() from user space?
  • dangling pointer, reason for value change after free()?
  • How to compile C program with multiple files in Xcode
  • Can you make an incrementing compiler constant?
  • Reading data from text file in C
  • SQLite's test code to production code ratio
  • Displaying an inverted pyramid of asterisks
  • sd spi mode in C language
  • printf("%2d") in C programming
  • Add a certain number of bytes to a void pointer in C
  • How should I protect against hard link attacks?
  • What's the difference between unsigned long/long/int in c/c++?
  • Get an input from keyboard without 'return' in C
  • How to convert if to switch-case in c
  • C: swapping two pointer value
  • What does \x mean in c/c++?
  • run a command line argument prog
  • Pass a dynamic structure by reference? [C]
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk