specifier

    -2熱度

    4回答

    %printf函數內部的d說明符意味着我們要將變量顯示爲十進制整數,而%f說明符會將其顯示爲浮點數等等。 但是%di說明符的作用是什麼? I found this specifier in this program(C program to add, subtract, multiply and divide Complex Numbers, complex arithmetic) 例如, pri

    -1熱度

    2回答

    當我運行此代碼時,D的輸出作爲值C出現。是因爲我要求一個浮點數,它只是在內存中使用最近的浮點數? #include <stdio.h> int main() { int a=3/2; printf("The value of 3/2 is : %d\n", a); float b=3.0/2; printf("The value of 3/2 is

    1熱度

    5回答

    考慮下面的代碼示例: #define STRING_LITERAL "%u, %u" const char string_const[ ] = "%u, %u"; snprintf(dest_buff, sizeof(dest_buff), STRING_LITERAL, arg1, arg2, arg3); 我的編譯器則發出警告: snprintf(dest_buff, sizeof(

    4熱度

    2回答

    假設我有一個變量S與字符串"1:3"(或就此而言,"1",或"1:"或":3"),我想使用,作爲對切片符列表L。你不能簡單地做L[S],因爲一個切片所需的參數是"int:int"。現在 ,我現在有一些醜陋的代碼解析S到它的兩個組成int S和處理所有邊緣案件(其中4)要拿出正確的片段中的存取,但是這僅僅是醜陋和unpythonic。 如何優雅地採取字符串S並將其用作我的切片說明符?

    0熱度

    2回答

    關於聲明; Every object declaration in C and C++ has two principal parts: a sequence of zero or more declaration specifiers, and a sequence of one or more declarators, separated by commas. For example: 是否零

    0熱度

    2回答

    有人可以解釋我在下面的代碼中說明符的王是什麼?並舉例說明。 printf("\r\x1b[32mConverting: \x1b[36m%d\x1b[0m",(Convert));

    0熱度

    1回答

    我試圖僅使用本手冊第二部分(http://man7.org/linux/man-pages/dir_section_2.html)中描述的Linux系統調用寫入stdout。 ssize_t write(int fd, const void *buf, size_t count); 是我嘗試使用的函數,但是我試圖將格式說明符合併到緩衝區中。理想情況下,它會這樣工作: char *adjecti

    3熱度

    4回答

    是否可以在C中編寫新的格式說明符?例如,可以說,%g是一個格式說明符,它以無符號整數等價的形式打印出A.B.C.D格式的IP地址。 int ip_addr = Some integer printf("ip address = %g", ip_addr); 輸出:在A.B.C.D格式打印IP地址

    2熱度

    1回答

    我使用%s作爲_cmd,最新的XCode會產生一個錯誤「Format specified type char * but the argument has type SEL」。檢查過的文檔並找不到線索。任何人都知道使用正確的字符串說明符?

    10熱度

    2回答

    在C++ 11 a 類型說明符包括類說明符和枚舉說明符。 (又名類定義和枚舉定義) 根據語法/語法 - 類型說明符可以出現在語言的多個位置,但不是所有這些地方都是類說明符和允許的枚舉說明符。 例如: struct C{} c; // ok: types may be defined in the specifiers of a simple declaration void f(struct