首先,我有一个功能,我有unsigned char*类型存储的标志.例如,Unicode中每个符号Abcdef!?为[65 0] [98 0] [99 0] [100 0] [101 0] [102 0] [33 0] [63 0]2个字节.
当我使用for(unsigned char i=0; i<17; i++) printf("%c", pointer[i]);一切正常时,它显示Abcdef!?.但是当我使用printf("%s" pointer);它时,它只给我,A而不是别的.你能告诉我为什么吗?
我正在写论文,我在C代码中使用C++函数有问题.我搜索了解决方案,但我找到了很多,但无论如何都没有用.请再向我解释一下.
要快我有类似下面后gcc main.c -o main,我得到undefined reference to 'cppfun'
cpp.h:
#pragma once
#ifdef __cplusplus
extern "C" {
#endi
void cppfun();
#ifdef __cplusplus
}
#endif
Run Code Online (Sandbox Code Playgroud)
cpp.cpp:
#include <stdio.h>
#include "cpp.h"
void cppfun()
{
printf("cpp_fun");
}
Run Code Online (Sandbox Code Playgroud)
main.c中:
#include <stdio.h>
#indlude "cpp.h"
int main(int argc, char *argv[])
{
cppfun();
return 0;
}
Run Code Online (Sandbox Code Playgroud)