@Faldahlawi
This is not true actually.
Although a is defined before b in the code, b has a lower address than a. It should be cp+=1 because cp is initially set to &b.
Note: If I changed cp to be initially set to a and changed the operation to cp-=1 , I still have the same weird behavior that the output is not correct (b) unless I print &b somewhere in the code.
User Profile
Collapse
-
Weird behavior of a pointer
The program below should outputs 'a' but it doesn't unless the commented line is uncommented.
I use MinGW compiler.
Code:int main() { char *cp; char a = 'a'; char b = 'b'; cp = &b; cp+=1; //printf("ap=%p\n",&a); printf("%c", *cp); return 0; }
-
Pre-increment in C++
Why would the following statement assign 12 to x not 11?
Code:int i=4; int x = (++i) + (++i); cout << x; // prints 12
-
-
Aren't there 3 columns, not 2? I count the colspan of 2 as being 2 columns....Leave a comment:
-
I'm not sure I got what you said.
Yes, it looks fine when I add a row at the beginning with 3 columns but doesn't work without it.
<table border>
<tr><td>A</td><td>A</td><td>A</td></tr>
<tr>
<td colspan="2">A</td>
<td>A</td>
</tr>
<tr>
<td>A</td>
<td...Leave a comment:
-
HTML colspan problem
I want to do an HTML table like the following:
I wrote the following code to generate it:
<table border>
<tr>
<td colspan="2">A</td>
<td>A</td>
</tr>
<tr>
<td>A</td>
<td colspan="2">A</td>
</tr>
</table>
But...
No activity results to display
Show More
Leave a comment: