File tree Expand file tree Collapse file tree 11 files changed +16
-30
lines changed Expand file tree Collapse file tree 11 files changed +16
-30
lines changed Original file line number Diff line number Diff line change 1- #include <stdio .h>
1+ #include <assert .h>
22
33int main ()
44{
Original file line number Diff line number Diff line change 1- #include <stdlib.h>
2- #include <stdio.h>
31#include <assert.h>
42
53typedef unsigned int u32 ;
64typedef unsigned long long int u64 ;
75
86typedef u32 (* myfuncptr )(u32 value );
97
10- u32 myfunc_1 (u32 value1 ){
11- return value1 * 2 ;
8+ u32 myfunc_1 (u32 value1 )
9+ {
10+ return value1 * 2 ;
1211}
1312
1413u32 myfunc_2 (u32 value2 ){
15- assert (value2 == 4 );
16- return value2 * 4 ;
14+ assert (value2 == 4 );
15+ return value2 * 4 ;
1716}
1817
1918int main (void ){
20- myfuncptr fptr = NULL ;
21- u32 value ;
19+ myfuncptr fptr = 0 ;
20+ u32 value ;
2221
22+ assert (fptr == 0 );
2323
24- assert (fptr == NULL );
25-
26- fptr = myfunc_1 ;
27- value = 2 ;
28- value = fptr (value ); //value should be 4 after this
29- assert (value == 4 );
30-
31- fptr = myfunc_2 ;
32- value = fptr (value ); //value should be 16 after this
33- assert (value == 16 );
24+ fptr = myfunc_1 ;
25+ value = 2 ;
26+ value = fptr (value ); //value should be 4 after this
27+ assert (value == 4 );
3428
29+ fptr = myfunc_2 ;
30+ value = fptr (value ); //value should be 16 after this
31+ assert (value == 16 );
3532}
Original file line number Diff line number Diff line change 11#include <stdarg.h>
2- #include <stdio.h>
32#include <assert.h>
43
54// how to do it:
Original file line number Diff line number Diff line change 1- #include <stdio.h>
21#include <assert.h>
32
43struct A {
Original file line number Diff line number Diff line change 1- #include <stdio.h>
21#include <assert.h>
32
43int main (int argc , char * * argv ) {
Original file line number Diff line number Diff line change 1- #include <stdio.h>
21#include <assert.h>
32
43int main (int argc , char * * argv ) {
Original file line number Diff line number Diff line change 1- #include <stdio.h>
21#include <assert.h>
32
43int main (int argc , char * * argv ) {
Original file line number Diff line number Diff line change 11#include <assert.h>
2- #include <stdio.h>
32
43int main ()
54{
Original file line number Diff line number Diff line change 1- #include <stdlib.h>
21#include <assert.h>
32
43int main ()
Original file line number Diff line number Diff line change 1- #include <assert.h>
2- #include <stdlib.h>
3-
41int main ()
52{
63 {
You can’t perform that action at this time.
0 commit comments