int plus plus 및 int plus equals 1의 차이

BoBro

그래서 나는 다음과 같이 내 sqlite 데이터베이스의 행으로 객체를 채우려 고합니다.

- (id) initWithSQLite:(sqlite3_stmt *)row andDatabase:(Database*)db
{
   self.valueX = sqlite3_column_int(row, 0);
   self.valueY = sqlite3_column_int(row, 1);
   self.valueZ = sqlite3_column_int(row, 2);
   //etc
   return self;
}

많은 속성이 있고 데이터베이스 마이그레이션 후에 더 많은 속성이 추가되고 있기 때문에 나는 현명한 사람이되어 코드를 다음과 같이 변경하려고했습니다.

- (id) initWithSQLite:(sqlite3_stmt *)row andDatabase:(Database*)db
{
   int i = 0;
   self.valueX = sqlite3_column_int(row, i);
   self.valueY = sqlite3_column_int(row, i++);
   self.valueZ = sqlite3_column_int(row, i++);
   //etc
   return self;
}

그러나 이것은 작동하지 않지만 변경하면 sqlite3_column_int(row, i+=1);작동하는 것 같습니다.

그래서 내 질문은 : i++의 차이점은 무엇입니까 i += 1?

BoBro

나는 그것을 알아! i++먼저 현재 값을 반환 i한 다음 1을 더하는 것 같습니다 . 하지만 i+=1먼저 번호를 추가하고 오직 다음의 값을 반환합니다 i. 따라서 코드를 이렇게 변경하면 모두 정상적으로 작동합니다.

- (id) initWithSQLite:(sqlite3_stmt *)row andDatabase:(Database*)db
{
   int i = 0;

   //i++ instead of i, 0 is the returned value here and not 1 as I expected:
   self.valueX = sqlite3_column_int(row, i++); 

   self.valueY = sqlite3_column_int(row, i++);
   self.valueZ = sqlite3_column_int(row, i++);
   //etc
   return self;
}

이걸로 누군가의 시간을 절약 할 수 있기를 바랍니다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

데이터 변수 / 상수 및 유형 int 상수 (C Primer Plus)

분류에서Dev

GetAsyncKeyState (int vKey)의 Dot Comma Minus Plus

분류에서Dev

Firefox 및 Chrome의 Adblock Plus

분류에서Dev

transform 및 plus <int> ()를 사용하여 벡터 요소의 합계 및 모듈로 10 ^ 9 + 7. 이렇게 할 수있는 방법이 있습니까?

분류에서Dev

SQL Developer와 SQL * Plus의 실행 차이

분류에서Dev

iPhone 6 및 6 Plus의 AutoLayout TableView 문제

분류에서Dev

iphone 6 및 6 plus의 tableview constraisnts

분류에서Dev

iPhone 6 및 6 Plus 용 Xcode의 중앙 테이블보기

분류에서Dev

Add value into database plus 1

분류에서Dev

iPhone 6 Plus의 UISplitViewController

분류에서Dev

iPhone 6 Plus의 Safari Cut 웹 페이지

분류에서Dev

iPhone 6 Plus의 Safari Cut 웹 페이지

분류에서Dev

MATLAB Plus 오차 막대?

분류에서Dev

자동 myFunc ()-> int 및 int myFunc ()의 차이점 또는 이점

분류에서Dev

SQL * PLUS의 쿼리 문제

분류에서Dev

iPhone 6 Plus의 Whatsapp 알림

분류에서Dev

Compression Plus 데이터 형식?

분류에서Dev

C #에서 '(int) a', 'a as int'및 Convert.ToInt32 (a)의 차이점

분류에서Dev

Cwiid Python을 사용하는 Wiimote Motion Plus의 Pitch 및 Yaw

분류에서Dev

C : scanf () 및 while () (C Primer Plus의 프로그래밍 실습 7.10)

분류에서Dev

앱의 조각에서 Google Plus 및 Facebook 로그인 오류

분류에서Dev

Android에서 Google Plus 및 Twitter 앱이 링크를 여는 위치

분류에서Dev

int (* function) (int, int)와 int * function (int, int)의 차이점

분류에서Dev

int a의 차이점; int b; 및 int a, b. (메모리 관리 존중)

분류에서Dev

int * a와 int * a = new int의 차이점

분류에서Dev

Plus symbol line height

분류에서Dev

Creating a SUBSTR in SQL Plus

분류에서Dev

Regression with unary plus

분류에서Dev

Firmata 및 Game Control Plus로 서보 제어

Related 관련 기사

  1. 1

    데이터 변수 / 상수 및 유형 int 상수 (C Primer Plus)

  2. 2

    GetAsyncKeyState (int vKey)의 Dot Comma Minus Plus

  3. 3

    Firefox 및 Chrome의 Adblock Plus

  4. 4

    transform 및 plus <int> ()를 사용하여 벡터 요소의 합계 및 모듈로 10 ^ 9 + 7. 이렇게 할 수있는 방법이 있습니까?

  5. 5

    SQL Developer와 SQL * Plus의 실행 차이

  6. 6

    iPhone 6 및 6 Plus의 AutoLayout TableView 문제

  7. 7

    iphone 6 및 6 plus의 tableview constraisnts

  8. 8

    iPhone 6 및 6 Plus 용 Xcode의 중앙 테이블보기

  9. 9

    Add value into database plus 1

  10. 10

    iPhone 6 Plus의 UISplitViewController

  11. 11

    iPhone 6 Plus의 Safari Cut 웹 페이지

  12. 12

    iPhone 6 Plus의 Safari Cut 웹 페이지

  13. 13

    MATLAB Plus 오차 막대?

  14. 14

    자동 myFunc ()-> int 및 int myFunc ()의 차이점 또는 이점

  15. 15

    SQL * PLUS의 쿼리 문제

  16. 16

    iPhone 6 Plus의 Whatsapp 알림

  17. 17

    Compression Plus 데이터 형식?

  18. 18

    C #에서 '(int) a', 'a as int'및 Convert.ToInt32 (a)의 차이점

  19. 19

    Cwiid Python을 사용하는 Wiimote Motion Plus의 Pitch 및 Yaw

  20. 20

    C : scanf () 및 while () (C Primer Plus의 프로그래밍 실습 7.10)

  21. 21

    앱의 조각에서 Google Plus 및 Facebook 로그인 오류

  22. 22

    Android에서 Google Plus 및 Twitter 앱이 링크를 여는 위치

  23. 23

    int (* function) (int, int)와 int * function (int, int)의 차이점

  24. 24

    int a의 차이점; int b; 및 int a, b. (메모리 관리 존중)

  25. 25

    int * a와 int * a = new int의 차이점

  26. 26

    Plus symbol line height

  27. 27

    Creating a SUBSTR in SQL Plus

  28. 28

    Regression with unary plus

  29. 29

    Firmata 및 Game Control Plus로 서보 제어

뜨겁다태그

보관