programming encountered such an error
error: aggregate value used where an integer was expected
printf(“t1 = %d\n”,(unsigned char)t1;
error: aggregate value used where an integer was expected
printf(“t1 = %d\n”,(unsigned char)t1;
the reason is that
C language Type casting can only be converted between quantitative types. The structural types (including union and struct) are not Scalar types, so the casting cannot be performed.
quantitative types include arithmetic types and pointer types, and arithmetic types include integer types and floating point types.
p>
can use union instead of data conversion
I generally use union instead of type conversion
union {
long l;
struct {
long a:10;
loing b: 10;
long c: 12} bits;
}
Read More:
- C language string processing error warning, c4996, sprintf, predicted, c4996, strcpy, c4996, strcat
- Error c2137 of C language: empty character constant (Fixed)
- error C2057: expected constant expression (Can the size of an array in C language be defined when the program is running?)
- Solution to the segmentation fault of single chain table in C language
- The function and usage of argc and argv in C language
- The C language qsort() function reports an error for overflow of – 2147483648 and 2147483648
- Explain stdin, stdout, stderr in C language
- C language error: stray ‘\ 240’ in program|
- TypeError: Error #1034: Type Coercion failed: cannot convert mx.managers::HistoryManagerImpl@f22eee1
- C language error: expected declaration or statement at end of input
- Solution to error [error] LD returned 1 exit status in C language
- C language problem: 0xc0000005: access conflict occurred when writing to location 0xffffcc.
- C language program running results flash back how to do
- C language — to solve the problem of program flashback when programming (in VS)
- C language write() function analysis: write failed bad address
- C language error – [error] expected declaration or statemt at end of input— solution.
- 【.Net Core】using declarations‘ is not available in C# 7.3. Please use language version 8.0 or greate
- When C language refers to a user-defined type as a parameter, an error segmentation fault is reported
- R language – error analysis – error in Call.graphics (C_ palette2, .Call(C_ palette2, NULL)) : invalid graphics state
- The language of C__ FILE__ 、__ LINE__ And line