console outputs smiley face

后端 未结 3 1800
遇见更好的自我
遇见更好的自我 2021-01-26 07:43

I have this code:

#include \"stdafx.h\"
#include 

typedef struct{
    int s1;
    int s2;
    char c1;
    char* arr;
}inner_struc;


int _tmain         


        
3条回答
  •  不知归路
    2021-01-26 08:16

    inner_struct.arr is declared as char *, which means it holds an array of characters (bytes). Do you want an array to hold the numbers 1, 2, 3? If so, use int. If you want letters, initialize the array with:

      char arr[3] = { 'a', 'b', 'c' };
    

    KC

提交回复
热议问题