int *a;
int b = 10;
a = &b;
printf("%p\t%d",a,*a);
// a 印出 0012FF70 , *a印出 10
//-----------------------------------------------------
int *a;
int b[] = {1,2,3};
a = b;
printf("%p\t%d\n",a,*a);
a++;
printf("%p\t%d\n",a,*a);
//印出 0012FF68 1
// 0012FF6C 2
//char (+1), short (+2), int (+4), float (+4),double (+8)
//-----------------------------------------------------
int *a;
int b[][2] = {{1,2},{3,4},{5,6}};
a = b[0];
printf("%p\t%d\n",a,*a);
a++;
printf("%p\t%d\n",a,*a);
a++;
printf("%p\t%d\n",a,*a);
//印出 0012FF5C 1
// 0012FF60 2
// 0012FF64 3
//-----------------------------------------------------
#include "stdio.h"
int neo_max(int a,int b)
{
return (a > b ? a: b);
}
int main(int argc, char* argv[])
{
int (*ptr)(int,int);
ptr = neo_max;
printf ("max is %d\n",ptr(1,2));
return 0;
}
//印出 max is 2
//-----------------------------------------------------
#include <stdio.h>
#include <windows.h>
#include <process.h>
void print_ch(void * a)
{
char ch = (char) a;
printf ("This is %c\n",ch);
}
int main(int argc, TCHAR* argv[])
{
_beginthread(print_ch,0,(void*)('a'));
_beginthread(print_ch,0,(void*)('b'));
return 0;
}
//印出 This is a
//印出 This is b
//----------------------------------------------------------
沒有留言:
張貼留言