为您找到"
main() {int a[4]={10,20,30,40},*p=a;printf('%d\n",*p++);printf
"相关结果约100,000,000个
printf("%d",fn); Will print its address as an int. The compiler may complain about the function pointer-to-int conversion. The correct way to print an address is: printf("%p",variable); EDIT: However, as Pascal and others mentioned, %p is only valid for pointers to objects, so there's no correct way of printing the adress of functions.
static int a[] = {10, 20, 30, 40, 50}; static int *p[] = {a, a+3, a+4, a+1, a+2}; int **ptr = p; ptr++; $\text{ptr-p} = \frac{\text{address of ptr} - \text{address of ...
Consider the following C program. #include int main ( ) { static int a [ ] = {10, 20, 30, 40, 50} ; static int *p [ ] = {a, a+3, a+4, a+1, a+2} ;
Determine Output: void main() { int a[] = {10,20,30,40,50}, j, *p; for(j=0; j a) 10 20 30 40 50 10 20 30 40 50 b) 10 20 30 40 50 Garbage Value c) Error d) None of These
In this tutorial, you will learn to use scanf() function to take input from the user, and printf() function to display output to the user with the help of examples.
@RockingSameer for the first one, there won't be problem but for the 2nd one as its double type (25.0 - 20.0 = 5.0) but using format specifier %d will cause Undefined behaviour.So type conversion needed here. Although for the first one also its good to typecast as we are dealing with "double" but using "%d" format specifier.
In the following program how would you print 50 using p? #include int main() { int a[]={10,20,30,40,50}; char *p; p = (char *)a; return 0; } Select one a.
这个主要考察操作符运优先算级别。*和++处于同一级别,而且都是右结合的。 所以对于第一个打印,*和p先结合后,既是*p也就是数组a第一个元素的值:10,然后和++结合,移到数组a第二个元素,也就是20;然后*和p,也即是*p,也就是第二个元素20的值,然后和++结合,所以输出21。
'下面程序的输出结果为 struct st { int x; int *y;} *p; int dt[4]={10,20,30,40}; struct st aa[4]={ 50,&dt[0],60,&dt[1], 70,&dt[2],80,&dt[3] }; main()
int x=4,y,z; //--x will decrement var x by 1 first THEN it will assign the value of x to y. //so: x = 3, y = 3 and z = nothing yet. y = --x; //x-- will assign the value of x to z first, then var x will be decremented by 1 after. //so: x = 2, y=3 and z = 3 z = x--; printf ("\n %d %d %d", x,y,z); }