C语言运算符优先级
摘要:优先级 运算符 名称或含义 使用形式 结合方向 说明 1 [] 数组下标 数组名[常量表达式] 左到右 -- () 圆括号 (表达式)/函数名(形参表) -- . 成员选择(对象) 对象.成员名 -- -> 成员选择(指针) 对象指针->成员名 -- 2 - 负号运算符 -表达式 右到左 单目运算符
阅读全文
invalid conversion from 'int' to 'main()::Week' [-fpermissive]
摘要:#include <stdio.h> #include <time.h> int main() { enum Week { sun,mon,tue,wed,thu,fri,sat }; enum Week today; struct tm *p; time_t t; time(&t); p=loca
阅读全文
函数指针与typedef
摘要:#include <stdio.h> // void (*fun)(void) = &fun//函数指针 // void *fun(void){return 指针}//指针函数 因为优先级变了 //void (*fun(void/int/char op))(void){return 函数指针;}//
阅读全文
typedef与宏定义的区别
摘要:宏定义 #include <stdio.h>#define interger int* //只是简单的替换,相当于int*b,int c,不能执行c=b//typedef int* interger;int main(){ int a=5; interger b,c; b=&a; c=b; prin
阅读全文
关于结构体数组与指针
摘要:#include <stdio.h> struct A { int num=5;// // } a[10]; struct B//全局变量 { // // }; struct B b[10];//全局变量 int main() { printf("%p\n",a);//可访问 printf("%p\
阅读全文