#include <stdio.h>
main() {
int a = 4;
short b;
double c;
int* ptr;
/* example of sizeof operator */
printf(Line 1 - Size of variable a = %d\n, sizeof(a) );
printf(Line 2 - Size of variable b = %d\n, sizeof(b) );
printf(Line 3 - Size of variable c= %d\n, sizeof(c) );
/* example of & and * operators */
ptr = &a; /* 'ptr' now contains the address of 'a'*/
printf(value of a is %d\n, a);
printf(*ptr is %d.\n, *ptr);
/* example of ternary operator */
a = 10;
b = (a == 1) ? 20: 30;
printf( Value of b is %d\n, b );
b = (a == 10) ? 20: 30;
printf( Value of b is %d\n, b );
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。