|
- #include <memory.h>
- #include <stdlib.h>
- #include <stdio.h>
- int uadd_ok(unsigned short x, unsigned short y);
- int main(void) {
- int* i_ptr = malloc(sizeof(int));
- if (i_ptr) {
- (void)printf("malloc() success...\n");
- // mem leak
- }
- unsigned short x1 =65530;
- int re = uadd_ok(x1,200);
-
-
- return re;
- }
-
- int func(void) {
- int* i_ptr = malloc(sizeof(int));
- if (i_ptr) {
- (void)printf("malloc() success...\n");
- // mem leak
- }
- }
- int uadd_ok(unsigned short x, unsigned short y){
- unsigned short sum =x+y;
- char c1;
- char c2 = -128;
-
- c1=~c2; //error
-
-
- if(sum >=x) {
- return 1;
- }
-
- if (c1 > 0) return 0;
-
- }
|