|
a = a + 1 or a += 1;
printf("%d", a);
정구일 님이 쓰신 글 :
: 안녕하세요.
: 이제 막 C를 시작한 초보 입니다.
: 이것 저것 공부 하다가 문제가 생겨서 질문드립니다.
: 변수 int a = 0; 으로 초기화 시킨후
: 밑에서 a + 1;
: 그리고 그 밑에 a + 1;
: 이렇게 하면 2가 나와야 하는데...
: <NULL> 값이 나옵니다.
: 뭐가 문제인지 지적 부탁드립니다!
: --< 소 스 코 드 첨 부 >--
: #include <stdio.h>
: #include <string.h>
:
: void main(void)
: {
: int a = 0;
:
: char word_a_1[] = "s";
: char word_a_2[] = "u";
: char word_a_3[] = "r";
: char word_a_4[] = "v";
: char word_a_5[] = "e";
: char word_a_6[] = "y";
:
: char word_b_1[] = "s";
: char word_b_2[] = "u";
: char word_b_3[] = "r";
: char word_b_4[] = "g";
: char word_b_5[] = "e";
: char word_b_6[] = "r";
: char word_b_7[] = "y";
:
: {
: if (!stricmp(word_a_1, word_b_1))
: printf("");
: else if (!stricmp(word_a_1, word_b_2))
: (a+1);
: else if (!stricmp(word_a_1, word_b_3))
: (a+1);
: else if (!stricmp(word_a_1, word_b_4))
: (a+1);
: else if (!stricmp(word_a_1, word_b_5))
: (a+1);
: else if (!stricmp(word_a_1, word_b_6))
: (a+1);
: else if (!stricmp(word_a_1, word_b_7))
: (a+1);
: else
: (a+1);
: }
: {
: if (!stricmp(word_a_2, word_b_2))
: printf("");
: else if (!stricmp(word_a_2, word_b_3))
: (a+1);
: else if (!stricmp(word_a_2, word_b_4))
: (a+1);
: else if (!stricmp(word_a_2, word_b_5))
: (a+1);
: else if (!stricmp(word_a_2, word_b_6))
: (a+1);
: else if (!stricmp(word_a_2, word_b_7))
: (a+1);
: else
: (a+1);
: }
: {
: if (!stricmp(word_a_3, word_b_3))
: printf("");
: else if (!stricmp(word_a_3, word_b_4))
: (a+1);
: else if (!stricmp(word_a_3, word_b_5))
: (a+1);
: else if (!stricmp(word_a_3, word_b_6))
: (a+1);
: else if (!stricmp(word_a_3, word_b_7))
: (a+1);
: else
: (a+1);
: }
: {
: if (!stricmp(word_a_4, word_b_4))
: printf("");
: else if (!stricmp(word_a_4, word_b_5))
: (a+1);
: else if (!stricmp(word_a_4, word_b_6))
: (a+1);
: else if (!stricmp(word_a_4, word_b_7))
: (a+1);
: else
: (a+1);
: }
: {
: if (!stricmp(word_a_5, word_b_5))
: printf("");
: else if (!stricmp(word_a_5, word_b_6))
: (a+1);
: else if (!stricmp(word_a_5, word_b_7))
: (a+1);
: else
: (a+1);
: }
: {
: if (!stricmp(word_a_6, word_b_6))
: printf("");
: else if (!stricmp(word_a_6, word_b_7))
: (a+1);
: else
: (a+1);
: }
: printf("%s", a);
: }
|