Please refer to the code that I saw in a certain c program:
#define _BUILD_DATE "2010/05/03$"
#define _BUILD_TIME "10:46:42$"
#define _BUILD_GUEST "Intel$"
#define _BUILD_BOARD "B0$"
#define _BUILD_CODEVER "2.00$"
const unsigned char SIGN_DATE[] = {_BUILD_DATE};
const unsigned char SIGN_TIME[] = {_BUILD_TIME};
const unsigned char SIGN_GUST[] = {_BUILD_GUEST};
const unsigned char SIGN_PCBV[] = {_BUILD_BOARD};
const unsigned char SIGN_CODEVR[] = {_BUILD_CODEVER};
I'm curious about why there's always a "$" mark at the end of each string. First I thought maybe I should follow this rule once I declared a string with "{" and "}",but the test below shows me that it still works fine.
#include <stdio.h>
unsigned char A[] = {"ABC$"};
//unsigned char A[] = {"ABC"};
unsigned char B[] = "123";
int main()
{
int i,j;
for(i=0;i<sizeof(A);i++)
{
if(A[i] == '\0')
printf("null\n");
else
printf("%c\n",A[i]);
}
printf("\n");
for(j=0;j<sizeof(B);j++)
{
if(B[j] == '\0')
printf("null\n");
else
printf("%c\n",B[j]);
}
printf("size of A is %d\n",(int)sizeof(A));
printf("size of B is %d\n",(int)sizeof(B));
return 0;
}
So I'm not sure if there is any special meaning of "$" in some situation, or it is just a meaningless mark.
Thanks for your time!