sizeof

    5

    4답변

    C에서 배열은 동적으로 크기가 지정되지 않는다는 것을 알고 있습니다. 염두에두고 다음 코드가 허용됩니까? char bytes[sizeof(double)]; 내 생각은 sizeof 프로그램 실행시 인수에서 작동 등이 허용되지 않을 것입니다. (이중 같은 길이 문자의 배열을 선언하려고),하지만 난 모르겠어요 . 또한 C 대신 C++를 사용하면 차이가 있습니

    12

    4답변

    은 내가 blog에 다음과 같은 템플릿을 발견 template <typename T, size_t N> struct array_info<T[N]> { typedef T type; enum { size = N }; }; 그것은 sizeof(a)/sizeof(a[0])에 우아한 대안입니다. 배열의 크기를 가져 오기 위해 일반적으로 사

    4

    3답변

    메신저하지만 초기화 할 수있는 다른 함수에서 sizeof char 배열 변수를 얻으려고 시도하지만 올바른 크기를 얻을 수 없습니다. int foo(uint8 *buffer){ cout <<"sizeof: "<< sizeof(buffer) <<endl; } int main() { uint8 txbuffer[13]={0}; uint8 uibuffer

    2

    5답변

    동일한 헤더를 포함하는 C로 작성된 두 개의 응용 프로그램이 있습니다. 이 헤더에는 struct 선언이 있습니다. GCC 컴파일러를 사용하여 두 응용 프로그램을 모두 컴파일합니다. 두 응용 프로그램을 모두 실행하면 다른 값이 sizeof(struct-defined-in-the-header)이됩니다. 왜 이런 일이 발생합니까?

    7

    4답변

    문제의 코드입니다 #include <stdio.h> struct test { unsigned char t; unsigned short u; unsigned char v; }; int main() { struct test * a = (void *) 0x1000; printf("%x %p %p\n",

    2

    1답변

    java.sizeOf을 다운로드했지만이 예외가 발생합니다. 나는 일식에서 달리고있다. 어떻게해야합니까? 일식에서 Exception in thread "main" java.lang.IllegalStateException: Instrumentation is null

    20

    1답변

    간단한 구조체에서 sizeof()를 사용할 수없는 이유는 무엇입니까? 예 : private struct FloatShortPair { public float myFloat; public short myShort; }; int size = sizeof(FloatShortPair); //CS0233 오류 CS0233 : 'Float

    9

    3답변

    가능한 중복 : 여기 Why are C character literals ints instead of chars? #include<stdio.h> int main(void) { char b = 'c'; printf("here size is %zu\n",sizeof('a')); printf("here size is %zu",si

    6

    3답변

    다형성 객체에 포인터 Base* base_ptr이 있습니다. 객체의 동적 유형의 크기를 알아낼 수 있습니까? AFAIK, sizeof(*base_ptr) 정적 유형의 크기는 base_ptr입니다. 나는 이것이 가능하지 않다고 생각하기 시작했으나, 아마도 나는 뭔가를 바라보고있다. 참고 : 제 유형의 계층 구조에 가상 함수를 추가하여 크기를 반환 할 수 있다

    4

    1답변

    : 대신를 sizeof의 sizeof 연산자는 ...이 경우에 작동하기 때문에 template <int n, int... xs> struct foo { static const int value = 0; }; // partial specialization where n is number of ints in xs: template <int.